I am writing a Perl/Tk script which displays Excel worksheets using the ss2tk example script from the Spreadsheet::Read module. It does not round off two decimal places but the function from Spreadsheet::XLSX::Utility2007 does round off to two decimal places. Why? I'm trying to use that second function as a feature of my program to offer conversion of the displayed worksheets to CSV files.
views:
186answers:
1
+1
A:
I see you were able to get an answer over at PerlMonks with the help of frieduck (any relation to friedo?), so I'm linking it up for the benefit of SO folks.
To summarize, basically it turned out that the internals of Spreadsheet::XLSX::Utility2007 were automatically applying a 2-decimal place format when retrieving the cell values. The two workarounds proposed were:
- Changing the way the module generates cell types (make it treat them all as defaults) by modifying XLSX internals.
- Changing the way the module treats the cells loaded from the spreadsheet (treating them as having the unformatted value from the original spreadsheet), also by modifying internals.
Either way, it was also mentioned that you'd probably be best off defining a local
sub to do perform the modified behavior, so that there aren't any nasty surprises resulting from changing the module in place.
Adam Bellaire
2009-10-01 12:52:06
It appears that frieduck has **no** relation to friedo.
Brad Gilbert
2009-10-01 16:23:47