Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::ParseExcel here are some pointers

1) State the issues as clearly and as concisely as possible. A simple program or Excel test file (see below) will often explain the issue better than a lot of text.

2) Provide information on your system, version of perl and module versions. The following program will generate everything that is required. Put this information in your bug report.

    #!/usr/bin/perl -w

    print "\n    Perl version   : $]";
    print "\n    OS name        : $^O";
    print "\n    Module versions: (not all are required)\n";

    my @modules = qw(
                      Spreadsheet::ParseExcel
                      Scalar::Util
                      Unicode::Map
                      Spreadsheet::WriteExcel
                      Parse::RecDescent
                      File::Temp
                      OLE::Storage_Lite
                      IO::Stringy
                    );

    for my $module (@modules) {
        my $version;
        eval "require $module";

        if (not $@) {
            $version = $module->VERSION;
            $version = '(unknown)' if not defined $version;
        }
        else {
            $version = '(not installed)';
        }

        printf "%21s%-24s\t%s\n", "", $module, $version;
    }

    __END__

3) Upgrade to the latest version of Spreadsheet::ParseExcel (or at least test on a system with an upgraded version). The issue you are reporting may already have been fixed.

4) Create a small example program that demonstrates your problem. The program should be as small as possible. A few lines of codes are worth tens of lines of text when trying to describe a bug.

5) Supply an Excel file that demonstrates the problem. This is very important. If the file is big, or contains confidential information, try to reduce it down to the smallest Excel file that represents the issue. If you don't wish to post a file here then send it to me directly: jmcnamara@cpan.org

6) Say if the test file was created by Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

7) If you are submitting a patch you should check with the maintainer whether the issue has already been patched or if a fix is in the works. Patches should be accompanied by test cases.

Asking a question

If you would like to ask a more general question there is the Spreadsheet::ParseExcel Google Group.

Report information
The Basics
Id: 18063
Status: resolved
Priority: 0/
Queue: Spreadsheet-ParseExcel

People
Owner: Nobody in particular
Requestors: grant_s [...] yahoo.com
Cc:
AdminCc:

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



Subject: Perl warnings on lines 1789, 1790
When ParseExcel parses an XLS file with cells having certain characteristics, it gives the following warnings: Character in "c" format wrapped at Spreadsheet/ParseExcel.pm line 1789. Character in "c" format wrapped at Spreadsheet/ParseExcel.pm line 1790. I'm sorry, I don't know what conditions produce the warnings, but those conditions are present in the first cell in the attached spreadsheet, but not the other cell. The warnings result from trying to unpack a 1-byte negative number, while unpack() thinks it is looking at a 4-byte number. To fix, we convert 1-byte negatives to 4-byte negatives by ORing with 0xFFFFFF00. The exact source code patch is attached. Distribution: Spreadsheet-ParseExcel-0.2603.tar.gz Perl version: v5.8.0 built for aix-thread-multi uname -a: AIX excelsioribm 2 5 00C0E82E4C00 Exact warning messages: see above Code to reproduce: attached, show-warnings.pl with gives-warnings.xls Patch to fix: attached, patch.txt
Subject: show-warnings.pl
#!/usr/bin/perl -w use File::Basename; use lib $ENV{HOME} . "/.perl"; use Spreadsheet::ParseExcel; my $oBook = Spreadsheet::ParseExcel::Workbook->Parse('gives-warnings.xls');
Subject: gives-warnings.xls
Download gives-warnings.xls
application/vnd.ms-excel 14.5k

Message body not shown because it is not plain text.

Subject: patch.txt
Spreadsheet/ParseExcel.pm lines 1789-1790: substr($sWk, 3, 1) &= pack('c', unpack("c",substr($sWk, 3, 1)) & 0xFC); substr($lWk, 0, 1) &= pack('c', unpack("c",substr($lWk, 0, 1)) & 0xFC); replace with: my $u = unpack("c",substr($sWk, 3, 1)) & 0xFC; $u |= 0xFFFFFF00 if ($u & 0x80); # raise neg bits for neg 1-byte value substr($sWk, 3, 1) &= pack('c', $u); $u = unpack("c",substr($lWk, 0, 1)) & 0xFC; $u |= 0xFFFFFF00 if ($u & 0x80); # raise neg bits for neg 1-byte value substr($lWk, 0, 1) &= pack('c', $u);
On Wed Mar 08 13:05:59 2006, guest wrote: Show quoted text
> When ParseExcel parses an XLS file with cells having certain > characteristics, it gives the following warnings: > Character in "c" format wrapped at Spreadsheet/ParseExcel.pm line 1789.
You fix was applied, it will be released soon in Spreadsheet-ParseExcel-0.27_02 many thanks for the test case and the fix Gabor Szabo <szabgab@gmail.com>
On Mon Sep 11 10:38:26 2006, SZABGAB wrote: Show quoted text
> On Wed Mar 08 13:05:59 2006, guest wrote:
> > When ParseExcel parses an XLS file with cells having certain > > characteristics, it gives the following warnings: > > Character in "c" format wrapped at Spreadsheet/ParseExcel.pm line
1789. Show quoted text
> > You fix was applied, it will be released soon in > Spreadsheet-ParseExcel-0.27_02 > > many thanks for the test case and the fix
This will break 64bit builds. I don't know if -256 is portable enough. Without patch: Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1597. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1601. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1597. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1601. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1597. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1601. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1597. Character in 'c' format wrapped in pack at /pro/lib/perl5/ site_perl/5.8.8/Spreadsheet/ParseExcel.pm line 1601. With patch it is clean: --- lib/Spreadsheet/ParseExcel.pm.org 2008-11-27 17:15:02.000000000 +0100 +++ lib/Spreadsheet/ParseExcel.pm 2008-11-27 17:10:14.000000000 +0100 @@ -1593,11 +1593,11 @@ sub _UnpackRKRec { elsif($iPtn == 1) { # http://rt.cpan.org/Ticket/Display.html?id=18063 my $u31 = unpack("c",substr($sWk, 3, 1)) & 0xFC; - $u31 |= 0xFFFFFF00 if ($u31 & 0x80); # raise neg bits for neg 1-byte value + $u31 |= -256 if ($u31 & 0x80); # raise neg bits for neg 1-byte value substr($sWk, 3, 1) &= pack('U', $u31); my $u01 = unpack("c",substr($lWk, 0, 1)) & 0xFC; - $u01 |= 0xFFFFFF00 if ($u01 & 0x80); # raise neg bits for neg 1-byte value + $u01 |= -256 if ($u01 & 0x80); # raise neg bits for neg 1-byte value substr($lWk, 0, 1) &= pack('U', $u01); return ($iF, unpack("d", ($BIGENDIAN)? $sWk . "\0\0\0\0": "\0\0\0\0". $lWk)/ 100);
Fixed in version 0.50 od ParseExcel. I rewrote the RK number conversion code and added a test suite. John. --