Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
M$22 May 02, 2009 05:27 PM

In Perl the xls2csv function from Spreadsheet::XLSX::Utility2007 rounds off to two decimal places, why?

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 2 decimal places but the function from Spreadsheet::XLSX::Utility2007 does round off to two decimal places. Why? I'm trying to use that 2nd function as a feature of my program to offer conversion of the displayed worksheets to CSV files.
Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Chosen by Asker

 
May 03, 2009 02:45 PM
On line 987 of Utility2007.pm, change

$output .= $cell->Value if(defined $cell);

to

$output .= $cell->unformatted if(defined $cell);

and then save your changes and reinstall the module if you edited the build copy instead of the installed copy.

I can't guarantee that will work, but from reading the docs, it would seem to....
Asker's Rating:
• Thanks for your answer. It didn't work even with module reinstalling with saved changes to the module, but I did get my script to work in a similar way by changing the Spreadsheet::XLSX module on which the Spreadsheet::XLSX::Utility2007 module relies, as follows:

my $cell =Spreadsheet::ParseExcel::Cell->new(
Val => $v,
Format => $thisstyle,
Type => $type
);

to

my $cell =Spreadsheet::ParseExcel::Cell->new(
Val => $v,
Format => $thisstyle,
Type => ""
);

I have a new question which I will post with the same price.


Helpful Answer?  (2)   (0)   

Helpful: adrianarcher, socrtwo

Tip mritty for this answer
Permalink | Report
   Reply  
 
 

Other Answers (1)

Sort By
 
May 02, 2009 10:10 PM
It might be uncouth to suggest it, but you should ask this on stackoverflow.com, I bet you'll get an answer there if you don't find one here!

Helpful Answer?  (0)   (0)    Tip adrianarcher for this answer
Permalink | Report
   Reply  
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Related Questions

No questions found.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • buddawiggi
    buddawiggi
    2nd Degree Black Belt
    25027 Points
    M$701.03 Earned
  • cfinke
    cfinke
    2nd Degree Black Belt
    23219 Points
    M$29.75 Earned
  • unwirklich
    unwirklich
    Purple Belt
    2323 Points
    M$131.55 Earned
   See All
 

Most Popular Tags

mahalo(1398)
iphone(449)
music(435)
google(324)
food(290)
beer(267)
online(266)
money(246)
apple(239)
movies(235)
aotd(233)
video(198)
health(197)
free(190)
dog(188)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.