Lori713 has asked for the wisdom of the Perl Monks concerning the following question:
However, this one does not (this one would put a dash (or hyphen) if the amount were 0). I get a message during the download that it doesn't like the number format.style="vnd.ms-excel.numberformat:#,##0.00_)[semicolon](#,##0.00);" style="vnd.ms-excel.numberformat:$* #,##0.00_)[semicolon][Black]$* (#, +##0.00);"
Note: There are two question marks after the "-" in that last line but they are somehow getting dropped out of the code snippet above. The same is true of the code snippet below in the else clause. Grrrrr... In Perl, the code is set up like this:style="vnd.ms-excel.numberformat:_(* #,##0.00_)[semicolon]_(* (#,##0.0 +0)[semicolon]_(* "-"??_)[semicolon]_(@_)"
Has anyone run into problems getting downloads to Excel to format numbers, or is there another way I can accomplish this? Is this an HTML-Template issue, Excel issue, or a S.O.L issue? I don't believe there are any characters I need to escape, and I used a single tick mark instead of double ticks so Perl won't try to interpret it (grasping at straws now...).# Format numbers style for download to Excel foreach my $c (qw(col_endow col_gfund col_restr col_total)) { if ( substr($key,0,3) eq "010" || substr($key,0,3) eq "023" + || substr($key,0,3) eq "025" || substr($key,0,3) eq "027" + || substr($key,0,3) eq "030" || substr($key,0,3) eq "043" + || substr($key,0,3) eq "045" || substr($key,0,3) eq "066" + || substr($key,0,3) eq "097" ) { $row_data{num_style} = 'style="vnd.ms-excel.numberform +at:$* #,##0.00_)[semicolon][Black]$* (#,##0.00);"'; } else { $row_data{num_style} = 'style="vnd.ms-excel.numberform +at:_(* #,##0.00_)[semicolon]_(* (#,##0.00)[semicolon]_(* "-"_)[semico +lon]_(@_)"'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: OT? Download to Excel number formats not working
by psini (Deacon) on Jul 31, 2008 at 19:26 UTC | |
by Lori713 (Pilgrim) on Jul 31, 2008 at 20:01 UTC | |
by psini (Deacon) on Jul 31, 2008 at 20:15 UTC | |
|
Re: Download to Excel number formats not working
by toolic (Bishop) on Jul 31, 2008 at 21:46 UTC | |
by Lori713 (Pilgrim) on Aug 01, 2008 at 13:52 UTC |