The World Is Flat



Taobao is a biggest online retail marketplace for consumers in China. Founded by parent Alibaba Group, it facilitates transactions between individual consumers and a wide range of sellers such as retailers, wholesalers, and other individuals. Similar to eBay, sellers are able to post new and used goods for sale on the Taobao marketplace either through a fixed price or negotiated sale or by auction. Primary competitors include eBay, yet reports have shown that Taobao has over 80% of the C2C market in China.

It was hackweek in Novell last week. I decided to make a Taobao extension in to facilitate Taobao users manager their transaction data including what they bough and what they sold. So that it could attract more people to use for it is reported that Taobao has over 100 million users in China. :-)

Firstly, I need to learn the Taobao Open Platform(TOP) which provides API to manager the business in Taobao. I wrote some example to learn how to use these API to get the transaction data of the user's bough and sold.

Secondly, I also need to spend some time learn how to make an extension in Java. And I found some examples to see how to make a custom menu and dialog in SDK.

Finally, I got a prototype that could import the transaction data from Taobao into Spreadsheet.

See the above sceenshot, a custom menu "Taobao" is added into Calc.
When "Taobao"->"Buy" is click, your bough data is imported in the spreadsheet.

Actully, this is just a demo, not a final version. I will improve this extension and upstream the codes and binary extension into Google project oootaobao.



* Update early, try to make vba for word work. dump the vbaapi.db and the Global interface is included in this db too. Compared the implementation of XGlobal between word and excel, find that SwVbaGlobals::getGlobalsImpl is missing. Add this function and build again. Success to run Application.Name(). Congratuation!!

* Update to dev300-m36

* Start to have a look at where to add an option for word macro import for Tools|Options|Load Save|VBA Properties| Executable code ( currently the patch just hard codes executeable code ). Like an option for excel macro import. ( Supposed it is a copy&paste task :-) )

A Simple Word VBA Macro

We Novell OOo team start to work on VBA for word support. Our first simple Word macro is running.

We also add a UI option in Tools -> Options -> Load/Save -> VBA Properties -> Executable code, to indicate whether the VBA macros are imported without comments to be executable.

Definitely, we have many things need to do. The first thing, I think, is about how to share the code with VBA for Excel.



* update the ooo-build to dev300-m36. I started to build dev300-m36 last night. When I came back this morning, found that some package were missing. For I just updated my system to SLED11 beta5, it seems these packages are removed when the system is updated. I had to install the missing packages again. It took me about 1hours to make the new build continue.

* Great to hear that Redflag 2000 guy Wanglibing wanted to start port new vba api. Answer his mail. Hope he can warm up quickly.

* Accept Noel's suggestion to start a new build based on dev300-m35 in another system for it is verified to use well.

* Overview the commandbar stuff. I am annoyed by the codes, ( seems not much better to port it from helperapi directly. had better to re-invent the wheel :-). Anyway, after some modification, some common issuees are fixed. and more common apis are added too.

Current existing problems:

1) Regarding commandbar stuff, the main difference between MS Office and OOo is that MS Office treats commandbar as toolbar ( main menu is a toolbar named "Worksheet Menu Bar" in Excell ), while OOo treats commandbar as menu and toolbar. The url of menu is "private:resource/menubar/menubar" for build-in menus or "" for customize menus. The url of toolbar is "private:resource/toolbar/" for build-in toolbars or is "private:resource/toolbar/custom_toolbar_***" for customize toolbars. In MSO, you can create customize toolbars in "tools->customize". In OOo, you can create customize menu/toolbar in "Tools->Customize". The related codes of the customize dialog is located in svx/source/dialog/cfg.cxx.

2) Confused with CommandBars("File") & CommandBars(1).Controls("File")
* CommandBars("File") returns a CommandBar object which type is msoBarTypePopup.
* CommandBars(1).Controls("File") returns a CommandBarControl object which type is msoControlPopup.

It seems they are referenced to the menu "File"

Note they are not supported in OOo VBA yet.

3) Currently OOo VBA only supports CommandBarControl, and doesn't support CommandBarPopup and CommandBarButton. In MSO both CommandBarPopup and CommandBarButton are common used. It is better to support them in OOo VBA. Both CommandBarPopup and CommandBarButton are based on CommandBarControl, So the following macro is OK in MSO

dim cbc1 as CommandBarControl
dim cbc2 as CommandBarControl
dim cbb as CommandBarButton
dim cbp as CommandBarPopup

set cbp = CommandBars(1).Controls.Add( Type:= msoControlPopup )
cbp.Caption = "Popup Menu 1"

set cbc1 = CommandBars(1).Controls.Add( Type:= msoControlPopup )
cbc1.Caption = "Popup Menu 2"

set cbb = cbp.Controls.Add( Type:= msoControlButton )

set cbc2 = cbp.Controls.Add( Type:= msoControlButton )

4) I think CommandBarControl.OnAction is an important api which is to set the name of a vb procedure that will run when the user clicks the menu/toolbar. Most of the reasons you create a customize menu/toolbar is to let user to run a vb procedure by clicking the menu/toolbar.
when OnAction is set, it needs to map the name os a vb procedure to a working command url of OOo. e.g.

myControl.OnAction = "Macro1"

The name "Macro1" needs to convert to a working command url like:

* Meet a couple of breaks when building dev300-m36. To saving time, abandon to build it. and focus to build dev300-m35.

* Start to have a look at the patch of vba for word.

* Team meeting


The progress of CJK functions

Recently in OOoCon 2007, I made a talk about the CJK (Chinese, Japanese and Korean) functions what I have been working on. I think it is better to show the progress to the world. If you have any hot issue about CJK functions, please let me know.

Here is the main CJK functions.

CJK functions that have been done:

  • Text grid enhancement

  • CJK font relevant stuff

  • MS Word compatibility options enhancement

CJK functions that I am working on:

  • Character/Line measurement unit and ruler

  • Paragraph style default settings for CJK

CJK functions that I will work on:

  • Punctuation compress

  • Bullets and numbering enhancement

OK, I will make a summary for each CJK function so that you could get more knowledge. :-)

Text grid enhancement (i76247)

One of the main CJK functions is text grid which is wildly used in CJK environment. For example, Chinese government document must use text grid with 22 lines per page and 28 characters per line.

However, there are two types of paper mode for text grid. One is "squared" paper mode which OOo supports currently, the other is "Standard" paper mode which most CJK versions of office suite (including MS Word) support.

What's the difference between these two types of paper mode.

For "squared" paper mode, as shown in Figure 1, the page is divided in a fixed numbers of lines , and each line is divided into square cells . The number of lines per page depends on the line height ( i.e., the sum of grid base and ruby height), and the Asian characters per line also depends on the line height.

Figure 1. Squared paper mode

In this type of paper mode, if we change the "Lines per page" setting in the "Text Grid" tab page, the type are of the page will be changed. This type of paper mode is only used in limited case. Most CJK users have habit to the “standard” paper mode.

Figure 2 illustrates the "Standard" paper mode. As we can see, the lines per page depends on the base text size, while the characters per line depends on the character width. The ruby text is unavailable anymore. Moreover if the lines per page is changed, the type area is not changed yet.

Figure 2. Standard paper mode

Now, both types of paper mode are supported in ooo-build. In order to ensure only one type paper mode is used in the whole document, as shown in figure 3, a global setting option is provided in Writer tab page (Tools -> Options -> OOo Writer -> General).The codes are also up-streamed which is under QA so far.

Figure 3. Global setting option for text grid

CJK font relevant

There are some issues about CJK font in OOo.

Asian font list box ( i73003 )

The Asian font list box in the character property dialog lists all the available fonts even if they are not Asian font in OOo currently. It is better to only list the available CJK fonts.

Figure 4. Asian font list box

CJK mess font ( i73003 )

The issue in current OOo is that the selected western font is applied to the CJK text even if the selected western font doesn't support CJK language. So I extend the usage of fontconfig to check whether the selected font supports CJK language before applying the selected font to the CJK text.

Figure 5. Mess font

Chinese font size (i54603 )

China has his own unit to measure font size such as "五号". Of course, there is a conversion map between Chinese font size unit and western font size unit.

Figure 6. Chinese font size

Font substitute (i54603 )

The fontconfig library is extended to use to find more suitable font when the desired font is missing. The patch is initialed by Caolan. We make it more better support Chinese.

Microsoft Word compatibility options enhancement (i78591 )

As we know, in MS Word, there are quite a lot of compatibility options which are used to control layout for different versions.

Now, OOo only supports a few of compatibility options. Most of them are not handled in WW8 filter, which may cause layout different when do .DOC-> OOo -> .DOC converter.

Of course, this is a common issue not just for CJK.

Actually, it is not necessay for OOo to handle all the compatibility options. But in order to improve the interoperability with MS Word, one alternative way is to store the unhandled compatibility options in document model when import a .DOC document, and save them out when export to .DOC document again.

Character/Line measurement unit and ruler (i72655 )

Character/line measurement unit and ruler is another important CJK function that OOo doesn't support now.

As shown in Figure 7 from MS Word 2003, character is used to measured the indentation of the paragraph, and the line is used to measure the paragraph spacing.

Figure 7. Character/line measurement unit

Also as shown in Figure 8 from MS Word 2003, the horizontal ruler can be measured by character, and the vertical ruler can be measure by line. Character/line ruler is always used in a document with text grid.

Figure 8. Character/line ruler

Paragraph style default settings for CJK (i54320 )

Currently, the paragraph style default settings are set for western users, some default values of the paragraph properties don't need the habit of CJK users.

For example, the default font size of western font size is 12pt, while it is 10.5pt for CJK. The current default tab spacing is 1.25cm, while it is too big in writing Chinese. It is better to use about 0.74cm in writing Chinese.

As shown in Figure 9, the current default setting of Asian typography is not suitable for CJK users yet.

Figure 9. Asian typography

Another example is the default value of automatic text indent. The automatic text indent is used to specify the leave spacing for the first line of a paragraph. The current default value is one-character while it is better to use two-characters in writing Chinese as shown in Figure.

Punctuation compress

As shown in Figure 10 , if two Chinese punctuation are close, the first one should be compressed to occupy only half spacing of a Character, not full spacing of a character.

Figure 10. punctuation compress

Butters and numberings (i70031 , i69855 )

I have heard many CJK users to complaint that the bullets and numbering are not so good.

For example, OOo can only automatic recognize Arabic numbers or alphabets. Most CJK numbers can not be automatic recognized.

In the end, some important CJK functions are listed in the following wiki.
If you have any good idea or suggestion about CJK functions, you are welcome to discuss in the wiki.


UOF Import Filter for OpenOffice.Org

The UOF - Uniform Office Format is an emerging standard, which is being developed by the Chinese Office Software Work Group (COSWG), led by the China Electronics Standard Institute (CESI), the Ministry of Information Industry (MII), major suppliers of Chinese office software suites, and other academic institutions.

This week is a hackfest week at Novell. I am hacking a UOF( Chinese Office File Format) import filter for This filter is an external component based on ODF-UOF Converter.

An extension is developed so that OpenOffice.Org is able to open UOF text document. Here is some screenshots.

Although some features such as paragraph style, table are supported yet, there are a lot of work need to do. I will continue to work on them when I get time.


UOF–OpenXML Translator

I was surprised the news that Microsoft announced UOF-OpenXML translator project with China. The goal of UOF–OpenXML translator :

"As part of Microsoft’s continued commitment to interoperability, Microsoft decided to work with CHINA Electronics Standardization Institute, Beijing Information Technology Institute, one of the co-creators of the UOF Chinese standard , Beihang University of Beijing and with other partners to create a Translator between UOF and Open XML and provide interoperability between the two formats in both directions. Microsoft is funding and providing technical architectural guidance for the development of the translator that will benefit millions of people who live in China."

In one sense, China is so important for Microsoft's further strategies.
It is time to do something about UOF plug-in for, isn't it?

The UOF-OpenXML project is available at
The UOF-ODF project is available at