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

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

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



Subject: data validation using a range in another worksheet doesn't work
Hi, the following parses ("Groups" is another worksheet), but doesn't work in Excel (2007): it shows a dropdown box on the designated cells, but it is always empty. If I view the validation in Excel it shows me exactly the range as given below. Manually entering the range in Excel works. $sheet->data_validation( 1, 0, $row, 0, { validate => 'list', source => '=Groups!$A$2:$A$10', }); I think I found the problem - range3d isn't handled the same way as range2d. The attached patch fixes the problem for me. Perl version : 5.008008 OS name : linux Module versions: (not all are required) Spreadsheet::WriteExcel 2.25 Parse::RecDescent 1.80 File::Temp 0.16 OLE::Storage_Lite 0.18 IO::Stringy 2.110 Spreadsheet::ParseExcel 0.49 Scalar::Util 1.18 Unicode::Map (not installed)
Suggested patch
--- /home/ccm_root/lib/perl5/site_perl/5.8.8/Spreadsheet/WriteExcel/Worksheet.pm.orig 2009-04-01 15:42:02.000000000 +0200 +++ /home/ccm_root/lib/perl5/site_perl/5.8.8/Spreadsheet/WriteExcel/Worksheet.pm 2009-04-01 15:42:46.000000000 +0200 @@ -7542,7 +7542,7 @@ } # Force 2d ranges to be a reference class. - s/_range2d/_range2dR/ for @tokens; + s/_range([23])d/_range${1}dR/ for @tokens; # Parse the tokens into a formula string. $formula = $parser->parse_tokens(@tokens);
On Thu Apr 02 03:21:15 2009, RSCHUPP wrote: Show quoted text
> > the following parses ("Groups" is another worksheet), > but doesn't work in Excel (2007):
Hi, Thanks. I had another report of this as well and I have a fix in version control for it. It will be in the next release. John. --
On Thu Apr 02 03:21:15 2009, RSCHUPP wrote: Show quoted text
> Hi, > the following parses ("Groups" is another worksheet), > but doesn't work in Excel (2007): it shows a dropdown box on > the designated cells, but it is always empty.
Hi, Actually the fix that I had in place wasn't for this issue but another one relating to the use of defined names. Excel 2003 only allows a validation list range to be defined for the current worksheet, so '=Groups!$A$2:$A$10' wouldn't be valid. Perhaps that has changed in Excel 2007. I don't have it installed so I cannot check. I checked with Excel 2008 for the Mac and it isn't allowed. Can you confirm that you can manually enter a list range such as '=Groups!$A$2:$A$10' in Excel 2007? John. --
Show quoted text
> Excel 2003 only allows a validation list range to be defined for the
current worksheet, so Show quoted text
> '=Groups!$A$2:$A$10' wouldn't be valid.
That's what I remembered as well. Show quoted text
> Can you confirm that you can manually enter a list range such as
'=Groups!$A$2:$A$10' in Show quoted text
> Excel 2007?
Yes - it even works :) You can't do it by marking a range with the mouse though, because the corresponding popup won't let you change sheets, but you can just type it in. I've attached a sample , the validation is on cell Users!B2 (this was produced by a German version of Excel, in case it matters). Cheers, Roderich
Download sample.xls
application/vnd.ms-excel 17.5k

Message body not shown because it is not plain text.

On Thu Apr 02 03:21:15 2009, RSCHUPP wrote: Show quoted text
> the following parses ("Groups" is another worksheet), > but doesn't work in Excel (2007): it shows a dropdown box on > the designated cells, but it is always empty. > If I view the validation in Excel it shows me exactly the > range as given below. Manually entering the range in Excel works.
Hi, I've tested this with Excel 2007 and I see that it *is* possible to specify a 3D area (such Sheet1!A1:A5) by manually inserting the sheet name. However, I think that this may be a minor bug/feature in Excel2007 since 1. Yt isn't possible in any previous version of Excel or Excel2008 for the Mac. 2. The data validation source selection dialog doesn't allow the selection of a range/area outside the current worksheet 3. It is explicitly not allowed by the MS-XLS specification: http://msdn.microsoft.com/en-us/library/cc313154.aspx In the section on DVParsedFormula it states "rgce MUST NOT contain a PtgArea3d or a PtgAreaErr3d". An area such as Sheet1!A1:A5 equates to a PtgArea3d. So, unfortunately I think that you have stumbled across a feature that probably shouldn't exist and would probably cause you problems further down the line if relied on it. What do you think? John. --
Subject: Re: [rt.cpan.org #44742] data validation using a range in another worksheet doesn't work
Date: Fri, 3 Apr 2009 12:59:54 +0200
To: bug-Spreadsheet-WriteExcel [...] rt.cpan.org
From: Roderich Schupp <schupp [...] argumentum.de>
On Fri, Apr 3, 2009 at 10:32 AM, John McNamara via RT <bug-Spreadsheet-WriteExcel@rt.cpan.org> wrote: Show quoted text
> However, I think that this may be a minor bug/feature in Excel2007 since > > 1. Yt isn't possible in any previous version of Excel or Excel2008 for > the Mac. > 2. The data validation source selection dialog doesn't allow the > selection of a range/area outside the current worksheet > 3. It is explicitly not allowed by the MS-XLS specification: > >    http://msdn.microsoft.com/en-us/library/cc313154.aspx
As a further data point, I opened the sheet in Excel 2003 SP3 (Windows) and it accepted and correctly interpreted the data validation. Show quoted text
> What do you think?
Your call. I would probably add something like my patch, but wouldn't tell anyone - after all, if you never use this feature (because you couldn't do it in Excel), you won't generate it with Perl either. It's just my general Excel ignorance that led me to try it :) Cheers, Roderich
Subject: Re: [rt.cpan.org #44742] data validation using a range in another worksheet doesn't work
Date: Sat, 4 Apr 2009 18:18:10 +0200
To: bug-Spreadsheet-WriteExcel [...] rt.cpan.org
From: Roderich Schupp <schupp [...] argumentum.de>
On Fri, Apr 3, 2009 at 12:59 PM, Roderich Schupp <schupp@argumentum.de> wrote: Show quoted text
> As a further data point, I opened the sheet in Excel 2003 SP3 (Windows) > and it accepted and correctly interpreted the data validation.
Ditto for Excel 2000 on Windows. Cheers, Roderich
On Fri Apr 03 07:00:29 2009, schupp@argumentum.de wrote: Show quoted text
> > 3. It is explicitly not allowed by the MS-XLS specification: > > > >    http://msdn.microsoft.com/en-us/library/cc313154.aspx
> > As a further data point, I opened the sheet in Excel 2003 SP3 > (Windows) > and it accepted and correctly interpreted the data validation. >
> > What do you think?
> > Your call. I would probably add something like my patch, but wouldn't > tell anyone - after all, if you never use this feature (because you > couldn't > do it in Excel), you won't generate it with Perl either. It's just my > general > Excel ignorance that led me to try it :) >
Hi Roderich, I think that it best to follow the MS specification and not allow this feature. If it was enabled I can see a scenario where a customer got used to having this feature and was disappointed when some version of Excel didn't support it or allow them to modify it. So, for the sake of conformance to the specification I'm going to reject this change. I hope you can appreciate why it is important to conform to the specification and won't be be too disappointed. :-( John. --
Subject: Re: [rt.cpan.org #44742] data validation using a range in another worksheet doesn't work
Date: Mon, 6 Apr 2009 14:18:07 +0200
To: bug-Spreadsheet-WriteExcel [...] rt.cpan.org
From: Roderich Schupp <schupp [...] argumentum.de>
On Mon, Apr 6, 2009 at 12:29 PM, John McNamara via RT <bug-Spreadsheet-WriteExcel@rt.cpan.org> wrote: Show quoted text
> I think that it best to follow the MS specification and not allow this > feature.
As I said, your call. However, I think you misinterpreted the spec: Show quoted text
> 3. It is explicitly not allowed by the MS-XLS specification: > > http://msdn.microsoft.com/en-us/library/cc313154.aspx > > In the section on DVParsedFormula it states "rgce MUST NOT contain a > PtgArea3d or a PtgAreaErr3d". An area such as Sheet1!A1:A5 equates to a > PtgArea3d.
This only holds if "Dv.valType not equal to 3" (where 3 is validation against a list). The next paragraph reads: If the Dv record that contains this DVParsedFormula in its Dv.formula1 field has a Dv.valType equal to 3, then the following MUST be true: - If rgce contains a PtgArea3d or a PtgAreaErr3d then the PtgArea3d or PtgAreaErr3d MUST be the only Ptg in rgce. - The root node of the parse tree of this field MUST NOT be a VALUE_TYPE, as described in Rgce. Cheers, Roderich
Closing this issue. Can't fix. Suggest using Excel::Writer::XLSX instead.