[Libreoffice] Approaches to enable international number format import/export in Calc

Kohei Yoshida kyoshida at novell.com
Mon Mar 7 21:04:17 PST 2011

On Mon, 2011-03-07 at 13:57 +0700, Samphan Raruenrom wrote:

> 1) When import from Excel, convert Excel LCID (4-8 hex digits) to
> Calc's natnum and calendar specifier. When export reverse the process
> to generate the appropriate Excel LCID.
> 2) When import form Excel, maintain Excel LCID as-is in Calc number
> format. When export use the LCID already there.

So, in my mind (as I stated repeatedly in bugzilla), solution 2) is the
only sane solution in my mind, and 1) will be messy at best, and
compromises round-tripping with Excel documents, which many users still
rely on.  1) would compromises both ODS and XLS exports, while 2) would
compromise only ODS at present, which can be rectified later as we work
on improving the standard.

With 1), the moment you import the Excel document into Calc, you've
already lost some info since (as you said) Excel to Calc mapping of
number formats are not perfect.  So, those number formats that do not
map to Calc's accurately are already gone for good, at the moment of
import.  With that kind of state, saving to either ODS or XLS will lose
some of the original data.

With 2), we still have to do imperfect mapping of number formats, but
only when saving to ODS, and that can still be improved as we improve
the ODS format itself to cover more formats (or extend ODS's own LCID
code to support the extended LCID).  And saving to XLS will preserve the
original number format code without any loss.  This will future-proof
ourselves in terms of preserving the number format first, then allow us
to focus on improving the interpretation of the extended LCID to cover
more locales and date types going forward.  All of that will be hidden
deep inside the implementation detail.

> So what do you think?

Given the above, to me the choice is clear.


Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>

More information about the LibreOffice mailing list