Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Why Does the Module(s) Round off to 2 Decimal Places?

by socrtwo (Sexton)
on May 03, 2009 at 13:26 UTC ( [id://761577]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Why Does the Module(s) Round off to 2 Decimal Places?
in thread Why Does the Module(s) Round off to 2 Decimal Places?

It turns out that is you change in the Spreadsheet::XLSX module:
my $cell =Spreadsheet::ParseExcel::Cell->new( Val => $v, Format => $thisstyle, Type => $type );
to
my $cell =Spreadsheet::ParseExcel::Cell->new( Val => $v, Format => $thisstyle, Type => "" );
It removes the formatting. There are still minor differences with what appears in the ss2tk display. The format that results from the change mentioned above seems to use the same sort of rounding that Excel itself does before displaying the raw data from worksheet#.xml files.

For instance a piece of raw data displayed in the ss2tk table and in the XML worksheet file is 1.3318000000000001 and changing the Spreadsheet::XLSX routine and using the Utility2007::xls2csv function and Excel itself displays a rounding to 1.3318.

Thanks again for the help.

Replies are listed 'Best First'.
Re^4: Why Does the Module(s) Round off to 2 Decimal Places?
by frieduck (Hermit) on May 03, 2009 at 14:10 UTC

    The change you've made appears to apply default formatting (i.e. ignoring the specified format for the cell), whereas the change I proposed to xls2csv (earlier reply) pulls the unformatted value as stored in the xlsx file.

    Personally, I'd change my local xls2csv sub, to avoid surprises in other uses of Spreadsheet::XLSX.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://761577]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found