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: 53812
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcel

People
Owner: Nobody in particular
Requestors: ddascalescu+perl [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 2.35
Fixed in: (no value)



Subject: Excel 2003: "File error: data may have been lost." on extra parens
On certain formulas containing extra parentheses, Excel will issue the warning: "File error: data may have been lost.", and the cell's contents will be "#N/A". Test script attached. Removing the parentheses around 42 will cause the problem to disappear.

    Perl version   : 5.010001
    OS name        : MSWin32
    Module versions: (not all are required)
                     Spreadsheet::WriteExcel     2.35
                     Parse::RecDescent           1.962.2
                     File::Temp                  0.22
                     OLE::Storage_Lite           0.19
                     IO::Stringy                 2.110
                     Spreadsheet::ParseExcel     (not installed)
                     Scalar::Util                1.21
                     Unicode::Map                (not installed)


Subject: Spreadsheet__WriteExcel_bug.pl
#!/usr/local/bin/perl -w use strict; use SpreadSheet::WriteExcel; my $formula = '= ( 42 ) - INDIRECT("B"&ROW())'; my $workbook = Spreadsheet::WriteExcel->new("$0.xls"); my $worksheet = $workbook->add_worksheet(); $worksheet->write_formula(0, 0, $formula);
On Tue Jan 19 03:35:10 2010, dandv wrote: Show quoted text
> On certain formulas containing extra parentheses, Excel will issue the > warning: > "File error: data may have been lost.", and the cell's contents will > be "#N/A". > Test script attached. Removing the parentheses around 42 will cause > the problem > to disappear.
Hi, It seems to be a bug in the formula parser. Unfortunately there isn't any easy fix. This probably won't get corrected until the formula parser is refactored, which is still several months away. John. --
Subject: Excel 2003 crashes on extra parens
This may be a related issue: a couple extra parenthesis cause Excel 2003 to crash when the user puts the cursor on the offending cell:

Show quoted text
#!/usr/local/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;

my $workbook = Spreadsheet::WriteExcel->new("$0.xls");
my $worksheet = $workbook->add_worksheet();

$worksheet->write(0, 0, [0..8]);
$worksheet->write_formula(0, 9, '=(INDIRECT("G"&ROW())) - INDIRECT("H"&ROW())' );

I'm using 2.37 on Strawberry 5.12.2.

--
Dan


On Tue Jan 19 05:00:20 2010, JMCNAMARA wrote:
Show quoted text
> On Tue Jan 19 03:35:10 2010, dandv wrote:
> > On certain formulas containing extra parentheses, Excel will issue the
> > warning:
> > "File error: data may have been lost.", and the cell's contents will
> > be "#N/A".
> > Test script attached. Removing the parentheses around 42 will cause
> > the problem
> > to disappear.
>
>
> Hi,
>
> It seems to be a bug in the formula parser. Unfortunately there isn't
> any easy fix.
>
> This probably won't get corrected until the formula parser is
> refactored, which is still several months away.
>
> John.

On Mon Apr 18 02:47:29 2011, dandv wrote: Show quoted text
> This may be a related issue: a couple extra parenthesis cause Excel > 2003 to > crash when the user puts the cursor on the offending cell:
Hi Dan, Thanks for that. Yes are correct. It is related to the same issue. Interestingly Excel 2007 strips the formula out when reading it so it isn't there to cause a crash. Unfortunately this is unlikely to be fixed at this stage so you will have to find a workaround t avoid formulas like this. These errors don't occur with Excel::Writer::XLSX but that is for Excel 2007+ only so that may not be suitable for you. John. --
Closing this issue. Can't fix. Suggest using Excel::Writer::XLSX instead.