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: 30368
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Spreadsheet-WriteExcel

People
Owner: Nobody in particular
Requestors: zhur [...] yandex-team.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.21



Subject: Bug with utf-8 strings in Formula.pm
Date: Tue, 30 Oct 2007 21:24:14 +0300
To: bug-Spreadsheet-WriteExcel [...] rt.cpan.org
From: Sergey Zhuravlev <zhur [...] yandex-team.ru>
Hi, WriteExcel make broken xls file if utf8 string used in formulas. How to repeat: Spreadsheet::WriteExcel->new(\*STDOUT) ->addworksheet() ->write_formula("A1", qq!="\x{43c}\x{430}\x{43c}\x{430}"!); Suggested fix: diff -U 7 -F '^sub ' -r Spreadsheet-WriteExcel-2.20.orig/lib/Spreadsheet/WriteExcel/Formula.pm Spreadsheet-WriteExcel-2.20/lib/Spreadsheet/WriteExcel/Formula.pm --- Spreadsheet-WriteExcel-2.20.orig/lib/Spreadsheet/WriteExcel/Formula.pm 2007-10-30 20:52:45.584613634 +0300 +++ Spreadsheet-WriteExcel-2.20/lib/Spreadsheet/WriteExcel/Formula.pm 2007-10-30 20:55:05.152679214 +0300 @@ -515,14 +515,23 @@ sub _convert_string { $str =~ s/""/"/g; # Substitute Excel's escaped double quote "" for " my $length = length($str); # TODO string length die "String in formula has more than 255 chars\n" if $length > 255; + # encode utf strings + if ($] >= 5.008) { + require Encode; + if (Encode::is_utf8($str)) { + $encoding = 1; + $str = Encode::encode("UTF-16LE", $str); + } + } + return pack("CCC", $ptg{ptgStr}, $length, $encoding) . $str; } ############################################################################### # # _convert_ref2d()
Fixed in Spreadsheet::WriteExcel version 2.21. Thanks, John. --