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

People
Owner: Nobody in particular
Requestors: gilles.fetis [...] orange.fr
Cc:
AdminCc:

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



Subject: add_write_handler() and write_datetime()
The handler added with add_write_handler() does not seem to be called when using write_datetime(). Maybe a good option would be to separate handlers and add a add_write_date_time_handler() function to avoid side effects.
On Tue Nov 04 12:03:02 2008, gilles504 wrote: Show quoted text
> The handler added with add_write_handler() does not seem to be called > when using write_date_time().
Hi, That is in correct. The handlers are only called for write() and not for any of the write_*() methods. That is the intention and I think (hope) that the documentation is clear about that. "This method is used to extend the Spreadsheet::WriteExcel write() method to handle user defined data". The difference between write() and write_date_time() is that write() is a generic method for handling different data types while write_date_time() is a specific method for handling a single data type. As such add_write_handler() exists to allow the user to extend or modify the behaviour of write(). This shouldn't be necessary for write_date_time(). John. --
Subject: re: [rt.cpan.org #40662] add_write_handler() and write_datetime()
Date: Thu, 6 Nov 2008 10:56:39 +0100 (CET)
To: bug-Spreadsheet-WriteExcel [...] rt.cpan.org
From: Gilles FETIS <gilles.fetis [...] orange.fr>
Show quoted text
> Message du 05/11/08 00:27 > De : "John McNamara via RT" > A : gilles.fetis@orange.fr > Copie à : > Objet : [rt.cpan.org #40662] add_write_handler() and write_datetime() > > > As such add_write_handler() exists to allow the user to extend or modify the behaviour of > write(). This shouldn't be necessary for write_date_time(). >
I agree, but in my case, the handler is used to store width of each column to perform a kind of autoresize (I did not write the code, found it somewhere). The columns with dates cannot be resized correctly because handler is not modified. I found a workaround (call write, then write_date_time) but it's not perfect. Also, maybe the missing feature is more the autoresize than the handler itself...
On Thu Nov 06 04:56:56 2008, gilles504 wrote: Show quoted text
> ... > in my case, the handler is used to store width of each > column to perform a kind of autoresize (I did not write > the code, found it somewhere).
There is an autofit example that comes with the distro. Perhaps you came across something like that: http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-2.25/examples/autofit.pl If so the you can modify the column widths outside of the callback function if you like: $worksheet->{__col_widths}->[$col] = $date_width; Show quoted text
> I found a workaround (call write, then write_date_time) but it's not > perfect.
That may not be a good workaround because Excel with Office Service Pack 3 installed complains if duplicate data is written to a cell. Show quoted text
> Also, maybe the missing feature is more the autoresize than the > handler itself...
Yes, this is probably true. I've avoided adding it until now because it is hard to determine accurately the width of a formatted string or number. However, I now think that I should implement it as a core feature since it is so commonly requested. So, look out for it in a future release. John. --