Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#7230 closed defect (fixed)

XLSX-export: trailing zeros make trouble with Excel

Reported by: TobWen Owned by: warmerdam
Priority: normal Milestone: 2.2.4
Component: OGR_SF Version:
Severity: normal Keywords:
Cc:

Description

(as discussed on IRC)

When writing XLSX using ogr2ogr, double get casted to float. These floats might create problems when loading the file in Microsoft Excel.

Here is a working patch to fix this problem. Thanks to the guys in #c++ on freenode.

Attachments (1)

xlsx_patch.diff (1008 bytes) - added by TobWen 5 months ago.

Download all attachments as: .zip

Change History (6)

Changed 5 months ago by TobWen

Attachment: xlsx_patch.diff added

comment:1 Changed 5 months ago by Even Rouault

%.16g instead of %.16f should be equivalent to your patch. But did you check that Excel will be happy with the scientific notation that will be output for small or big numbers, like 1.23456e-20

comment:2 Changed 5 months ago by TobWen

Yeah, I wrote about %.16g in the channel yesterday. But it might work up to 1016 only. I'll try and report soon. My patch works for 100%, tested on some hundred thousand lines :)

comment:3 Changed 5 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 41414:

XLSX: on writing, use %.16g formatting for floating point numbers (fixes #7230, patch by TobWen?)

comment:4 Changed 5 months ago by Even Rouault

In 41415:

XLSX: on writing, use %.16g formatting for floating point numbers (fixes #7230, patch by TobWen?)

comment:5 Changed 5 months ago by Even Rouault

Component: defaultOGR_SF
Milestone: 2.2.4
Version: svn-trunk
Note: See TracTickets for help on using tickets.