Opened 6 years ago

Closed 6 years ago

Last modified 6 years 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 6 years ago.

Download all attachments as: .zip

Change History (6)

by TobWen, 6 years ago

Attachment: xlsx_patch.diff added

comment:1 by Even Rouault, 6 years ago

%.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 by TobWen, 6 years ago

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 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 41414:

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

comment:4 by Even Rouault, 6 years ago

In 41415:

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

comment:5 by Even Rouault, 6 years ago

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