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

People
Owner: jmcnamara [...] cpan.org
Requestors: mynamewasgone [...] gmail.com
Cc:
AdminCc:

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



Subject: Hyperlinks are always formatted as text
As Requested: Hi, I'm using this module and I needed to hyperlink numbers, so i added a method _write_guess after _write, and put the checks for blank, string, formula and number in there. Then I changed writre and the 3 _write_url methods to call _write_guess so that numbers would be numbers not string. The numbers are still by default formatted just blue underline, but I couldn't see a particulary painless way of changing that. This also works for formats as far as I can see.
--- Worksheet.pm.old 2005-09-07 13:13:41.000000000 +0100 +++ Worksheet.pm 2005-09-07 13:52:59.000000000 +0100 @@ -1092,14 +1092,6 @@ if (ref $token eq "ARRAY") { return $self->write_row(@_); } - # Match integer with leading zero(s) - elsif ($self->{_leading_zeros} and $token =~ /^0\d+$/) { - return $self->write_string(@_); - } - # Match number - elsif ($token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { - return $self->write_number(@_); - } # Match http, https or ftp URL elsif ($token =~ m|^[fh]tt?ps?://|) { return $self->write_url(@_); @@ -1111,6 +1103,36 @@ # Match internal or external sheet link elsif ($token =~ m[^(?:in|ex)ternal:]) { return $self->write_url(@_); + } else { + return $self->_write_guess(@_); + } + +} + + +############################################################################### +# +# _write_guess($row, $col, $token, $format) +# +# Parse $token and call appropriate write method. $row and $column are zero +# indexed. $format is optional. +# +# Returns: return value of called subroutine +# +# +sub _write_guess { + + my $self = shift; + + my $token = $_[2]; + + # Match integer with leading zero(s) + if ($self->{_leading_zeros} and $token =~ /^0\d+$/) { + return $self->write_string(@_); + } + # Match number + elsif ($token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { + return $self->write_number(@_); } # Match formula elsif ($token =~ /^=/) { @@ -1991,7 +2013,7 @@ # Write the visible label using the write_string() method. $str = $url unless defined $str; - my $str_error = $self->write_string($row1, $col1, $str, $xf); + my $str_error = $self->_write_guess($row1, $col1, $str, $xf); return $str_error if $str_error == -2; @@ -2063,7 +2085,7 @@ # Write the visible label $str = $url unless defined $str; - my $str_error = $self->write_string($row1, $col1, $str, $xf); + my $str_error = $self->_write_guess($row1, $col1, $str, $xf); return $str_error if $str_error == -2; @@ -2146,7 +2168,7 @@ # Write the visible label ($str = $url) =~ s[\#][ - ] unless defined $str; - my $str_error = $self->write_string($row1, $col1, $str, $xf); + my $str_error = $self->_write_guess($row1, $col1, $str, $xf); return $str_error if $str_error == -2; @@ -4286,3 +4308,4 @@ All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. +
I agree that this is a bug and I will endeavour to fix it in the next release, or perhaps in a pre-release. I'll post the details here but you may also like to keep and eye on: http://groups.google.com/group/spreadsheet-writeexcel John. --
Fixed in version 2.16. John. --