Skip Menu |

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

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::WriteExcel 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::WriteExcel
                      Parse::RecDescent
                      File::Temp
                      OLE::Storage_Lite
                      IO::Stringy
                      Spreadsheet::ParseExcel
                      Scalar::Util
                      Unicode::Map
                    );

    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::WriteExcel (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 but complete example program that demonstrates your problem. The program should be as small as possible. At the same time it should be a complete program that generates an Excel file. If the Spreadsheet::WriteExcel section is part of a much larger program then simplify it down to the essentials. Simulate any DB reads with an array.

5) Say if you tested with Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

6) If you are submitting a patch you should check with the author 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::WriteExcel Google Group.

Report information
The Basics
Id: 41048
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcel

People
Owner: Nobody in particular
Requestors: JJSCHUTZ [...] cpan.org
Cc:
AdminCc:

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



Subject: UTF8 URLs cause generation of corrupted file
If a UTF8-encoded URL containing non-ascii characters is passed to write() or write_url(), the following warning is generated and the resulting spreadsheet cannot be opened (file corruption error): Wide character in print at /usr/lib/perl5/site_perl/5.8.8/Spreadsheet/WriteExcel/Worksheet.pm line 1846. Please see test program attached that demonstrates the problem. Issue seems to be that, unlike write_string(), write_url() does not have special handling for UTF8 strings. (Could there be other write_xxx routines similarly affected?) Workarounds are to ensure all URLs are URL-encoded to begin with, or add a write handler to circumvent logic in the write() method and pass the URL to write_string instead of write_url. -- Jon Schutz My tech notes http://notes.jschutz.net Chief Technology Officer http://www.youramigo.com YourAmigo
Subject: spreadsheet_writeexcel_url_test.pl
#! /usr/bin/perl use strict; use warnings; use utf8; use Spreadsheet::WriteExcel; open my $fh, '>', 'test.xls' or die "Failed to open test file: $!"; binmode $fh, ':bytes'; my $xls = Spreadsheet::WriteExcel->new($fh); my $worksheet = $xls->add_worksheet("Test Worksheet"); my $row = 0; # Include either of the following lines to generate a corrupted file $worksheet->write($row++, 0, "http://url.with/special/characters/\x{65e5}\x{672c}\x{8a9e}"); $worksheet->write_url($row++, 0, "http://url.with/special/characters/\x{65e5}\x{672c}\x{8a9e}"); # Writing string is fine. $worksheet->write($row++, 0, "String with special characters \x{65e5}\x{672c}\x{8a9e}"); $xls->close();
On Tue Nov 18 19:14:07 2008, JJSCHUTZ wrote: Show quoted text
> If a UTF8-encoded URL containing non-ascii characters is passed to > write() or write_url(), the following warning is generated
Hi Jon, Thanks for that I'll look into it. John. --
On Tue Nov 18 19:14:07 2008, JJSCHUTZ wrote: Show quoted text
> If a UTF8-encoded URL containing non-ascii characters is passed to > write() or write_url(), the following warning is generated and the > resulting spreadsheet cannot be opened (file corruption error):
Hi Jon, Thanks for the test case. I've put a fix in place that will be in the next release. In the meantime you can try the following pre-release if you wish: http://homepage.eircom.net/~jmcnamara/perl/prerel/Spreadsheet-WriteExcel-2.25.07.tar.gz John. --
Fixed in release 2.26. Thanks for your help. John. --