LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   perl problem with Spreadsheet::XLSX::Utility2007 (https://www.linuxquestions.org/questions/linux-software-2/perl-problem-with-spreadsheet-xlsx-utility2007-911039/)

qrange 10-31-2011 05:23 AM

perl problem with Spreadsheet::XLSX::Utility2007
 
there is a problem with ExcelFmt() subroutine. when I try this:

Code:

print ExcelFmt('hh:mm', $time), "\n";
to get time in hour:minute format, it fails if time is 12:00 AM, with error:
Code:

Use of uninitialized value $dObj in int at /usr/share/perl5/Spreadsheet/XLSX/Utility2007.pm line 775.
Use of uninitialized value $dObj in subtraction (-) at /usr/share/perl5/Spreadsheet/XLSX/Utility2007.pm line 776.

what to do?
thanks.

qrange 10-31-2011 08:34 AM

this has been solved. problem was that 12:00 AM is stored in excel cell as 0. (excel seems to store time as percentage of day). but for some reason, perl module returned that value as NULL. so I used:

Code:

my $time = 0; 
$time=$Cell->{Val} if( $Cell->Value );



All times are GMT -5. The time now is 08:43 PM.