Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

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

X Report information
Id: 39892
Status: resolved
Worked: 1 hour (60 min)
Left: 0 min
Priority: 0/0
Queue: Spreadsheet-ParseExcel

Owner: Nobody
Requestors: rbo [...] cpan.org
Cc:
AdminCc:

Severity: Important
Broken in: 0.33
Fixed in: (no value)




X History Display mode: Brief headersFull headers
#   Wed Oct 08 09:54:07 2008 rbo - Ticket created  
Subject: error in value parsing
[text/plain 2.2k]
Hey,

since version 0.33 i have a problem with a value in my spreadsheet
t.xls. Row 2 column D (1,3) in t.xls contains "19.2".
But the parser in version 0.33 returns -1.60038629962926e-162 instead of
19.2.

I have a little test script based on the one from cpan for this output:

Spreadsheet::ParseExcel: 0.33
Output:
( 0 , 4 ) => bitmap (Type: Text,Length: 6)
( 0 , 5 ) => today (Type: Text,Length: 5)
( 0 , 6 ) => silly field (with random characters) (Type: Text,Length: 36)
( 1 , 0 ) => 45235 (Type: Numeric,Length: 5)
( 1 , 1 ) => sdfgdfg (Type: Text,Length: 7)
( 1 , 2 ) => 7 (Type: Numeric,Length: 1)
( 1 , 3 ) => -1.60038629962926e-162 (Type: Numeric,Length: 22)
( 1 , 5 ) => 37726 (Type: Numeric,Length: 5)
( 1 , 6 ) => I like cake (Type: Text,Length: 11)
Sheet: Sheet2
Sheet: Sheet3


Spreadsheet::ParseExcel: 0.32
Output:
Sheet: Sheet1
( 0 , 0 ) => ID (Type: Text,Length: 2)
( 0 , 1 ) => text (Type: Text,Length: 4)
( 0 , 2 ) => number (Type: Text,Length: 6)
( 0 , 3 ) => math (Type: Text,Length: 4)
( 0 , 4 ) => bitmap (Type: Text,Length: 6)
( 0 , 5 ) => today (Type: Text,Length: 5)
( 0 , 6 ) => silly field (with random characters) (Type: Text,Length: 36)
( 1 , 0 ) => 45235 (Type: Numeric,Length: 5)
( 1 , 1 ) => sdfgdfg (Type: Text,Length: 7)
( 1 , 2 ) => 7 (Type: Numeric,Length: 1)
( 1 , 3 ) => 19.2 (Type: Numeric,Length: 4)
( 1 , 5 ) => 37726 (Type: Numeric,Length: 5)
( 1 , 6 ) => I like cake (Type: Text,Length: 11)
Sheet: Sheet2
Sheet: Sheet3


My Perl Version is 5.8.8, only Spreadsheet::ParseExcel version has been
changed between tests.

t.xls is attached.

--- Test Script:

#!/usr/bin/env perl

use strict;
use warnings;

use Spreadsheet::ParseExcel;

my $excel = Spreadsheet::ParseExcel::Workbook->Parse('t.xls');
foreach my $sheet (@{$excel->{Worksheet}}) {
printf("Sheet: %s\n", $sheet->{Name});
$sheet->{MaxRow} ||= $sheet->{MinRow};
foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {
$sheet->{MaxCol} ||= $sheet->{MinCol};
foreach my $col ($sheet->{MinCol} .. $sheet->{MaxCol}) {
my $cell = $sheet->{Cells}[$row][$col];
if ($cell) {
printf("( %s , %s ) => %s (Type: %s,Length: %i)\n", $row,
$col, $cell->{Val},$cell->{Type},length($cell->{Val}));
}
}
}
}


Thanks and best regards

robert
Subject: t.xls

[application/octet-stream 8k]
Message body not shown because it is too large or is not plain text.
#   Wed Oct 08 12:14:39 2008 JMCNAMARA - Correspondence added  
[text/plain 470b]
Hi,

This came up on Perlmonks as well:

http://www.perlmonks.org/index.pl?node_id=715225

In the <tt>_UnpackRKRec()</tt> sub in <tt>ParseExcel.pm</tt> the
following lines:


...
substr($sWk, 3, 1) &= pack('U', $u31);
...
substr($lWk, 0, 1) &= pack('U', $u01);
...


should probably be:


...
substr($sWk, 3, 1) &= pack('c', $u31);
...
substr($lWk, 0, 1) &= pack('c', $u01);
...

John.
--

#   Wed Oct 08 12:14:41 2008 RT_System - Status changed from 'new' to 'open'  
#   Tue Oct 28 12:46:16 2008 JMCNAMARA - Correspondence added 60 min  
[text/plain 22b]
Fixed in version 0.41.
#   Tue Oct 28 12:46:19 2008 JMCNAMARA - Status changed from 'open' to 'resolved'