Skip Menu |
 

This queue is for tickets about the Spreadsheet-WriteExcel-Simple CPAN distribution.

Report information
The Basics
Id: 29328
Status: new
Priority: 0/
Queue: Spreadsheet-WriteExcel-Simple

People
Owner: Nobody in particular
Requestors: ken.gibson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: suggestions for Spreadsheet::WriteExcel::Simple
Date: Wed, 12 Sep 2007 13:53:22 -0500
To: bug-Spreadsheet-WriteExcel-Simple [...] rt.cpan.org
From: "Ken Gibson" <ken.gibson [...] gmail.com>
Download (untitled) / with headers
text/plain 1.6k
Cheers. Just started using Spreadsheet::WriteExcel::Simple, FromDB and FromDB::Query. Love them. Only one problem I've had with them so far - Excel turns large numbers from a database query into exponential notation. (Thanks MS :) In other words, 6036530000796707 gets converted automagically into 6.03 x 10e15. I applied two changes to Simple to correct the problem. I believe it was the second one that finally did it, but left them both in in case there was something else going on I'm not aware of. Seems to be working now. Here's the diff, if you find it useful. --- /usr/local/src/Spreadsheet-WriteExcel-Simple-1.04/Simple.pm 2006-01-16 05:16:32.000000000 -0600 +++ /usr/lib/perl5/site_perl/5.8.8/Spreadsheet/WriteExcel/Simple.pm 2007-09-12 13:37:27.000000000 -0500 @@ -59,6 +59,14 @@ $self->{bold} = $self->book->addformat(); $self->{bold}->set_bold; $self->{sheet} = $self->book->addworksheet; + +############################################ +# added formatting in an attempt to prevent +# Excel from dropping leading +# zeros. Thanks Microsoft! +############################################ + + $self->{sheet}->keep_leading_zeros(); $self->{_row} = 0; $self; } @@ -84,7 +92,16 @@ my $fmt = shift || ''; my $col = 0; my $ws = $self->sheet; - $ws->write($self->{_row}, $col++, $_, $fmt) foreach @data; + + #$ws->write($self->{_row}, $col++, $_, $fmt) foreach @data; + +############################### +# changed this to prevent Excel +# from converting large numbers +# to exponential notation +############################### + + $ws->write_string($self->{_row}, $col++, $_, $fmt) foreach @data; $self->{_row}++; } Thanks Ken


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.