Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Spreadsheet-ParseExcel CPAN distribution.

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::ParseExcel 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(

    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;


3) Upgrade to the latest version of Spreadsheet::ParseExcel (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 example program that demonstrates your problem. The program should be as small as possible. A few lines of codes are worth tens of lines of text when trying to describe a bug.

5) Supply an Excel file that demonstrates the problem. This is very important. If the file is big, or contains confidential information, try to reduce it down to the smallest Excel file that represents the issue. If you don't wish to post a file here then send it to me directly:

6) Say if the test file was created by Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

7) If you are submitting a patch you should check with the maintainer 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::ParseExcel Google Group.

Report information
The Basics

Nobody in particular
julio.fraire [...]

Broken in:
Fixed in:
(no value)

Subject: Spreadsheet::ParseExcel::SaveParser does not handle merged cells correctly
Dear Gábor, S::PE::SaveParser uses S::WriteExcel's deprecated set_merge method instead of the newer merge_range method. This causes merged cells not to be merged in the destination file. Please find attached a diff file to correct this problem. Note that it also adds a 'use Spreadsheet::ParseExcel' at the top of the file, as reported by another user. I am using version 0.06 of this module (distribution version is 0.32). Best regards, Julio Fraire
Subject: merged_areas.diff
--- 2008-02-04 10:04:24.000000000 -0600 +++ 2008-02-07 11:55:20.000000000 -0600 @@ -11,6 +11,7 @@ use strict; use warnings; +use Spreadsheet::ParseExcel; use base 'Spreadsheet::ParseExcel::Workbook'; our $VERSION = '0.06'; @@ -114,6 +115,17 @@ for(my $iSheet=0; $iSheet < $oBook->{SheetCount} ; $iSheet++) { my $oWkS = $oBook->{Worksheet}[$iSheet]; my $oWrS = $oWrEx->addworksheet($oWkS->{Name}); + + # Merged areas + foreach my $area ( @{ $oWkS->{MergedArea} } ) { + + my $cell = $oWkS->Cell($area->[0], $area->[1]); + my $oFmtN = $oWrEx->addformat(); + $oFmtN->copy($hFmt{$cell->{FormatNo}}); + $oWrS->merge_range( @$area, $cell->{Val}, $oFmtN, utf8::is_utf8($cell->{Val})); + } + + #Landscape if(!$oWkS->{Landscape}) { # Landscape (0:Horizontal, 1:Vertical) $oWrS->set_landscape(); @@ -123,12 +135,12 @@ } #Protect if(defined $oWkS->{Protect}) { # Protect ('':NoPassword, Password:Password) - if ($oWkS->{Protect} ne '') { - $oWrS->protect($oWkS->{Protect}); - } - else { - $oWrS->protect(); - } + if ($oWkS->{Protect} ne '') { + $oWrS->protect($oWkS->{Protect}); + } + else { + $oWrS->protect(); + } } if(($oWkS->{FitWidth}==1) and ($oWkS->{FitHeight}==1)) { # Pages on fit with width and Heigt @@ -215,17 +227,9 @@ my $oWkC = $oWkS->{Cells}[$iR][$iC]; if($oWkC) { - if($oWkC->{Merged}) { - my $oFmtN = $oWrEx->addformat(); - $oFmtN->copy($hFmt{$oWkC->{FormatNo}}); - $oFmtN->set_merge(1); - $oWrS->write($iR , $iC, $oBook->{FmtClass}->TextFmt($oWkC->{Val}, $oWkC->{Code}), - $oFmtN); - } - else { - $oWrS->write($iR , $iC, $oBook->{FmtClass}->TextFmt($oWkC->{Val}, $oWkC->{Code}), - $hFmt{$oWkC->{FormatNo}}); - } + next if $oWkC->{Merged}; + $oWrS->write($iR , $iC, $oBook->{FmtClass}->TextFmt($oWkC->{Val}, $oWkC->{Code}), + $hFmt{$oWkC->{FormatNo}}); } } }

This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with to