Skip Menu | will be shut down on March 1st, 2021.

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

Report information
The Basics
Id: 132420
Status: new
Priority: 0/
Queue: Spreadsheet-XLSX

Owner: Nobody in particular
Requestors: mdoemling [...]

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

Subject: Fix for formatCode being lost
Date: Fri, 24 Apr 2020 15:37:55 -0700
To: bug-Spreadsheet-XLSX [...]
From: Marcus Doemling <mdoemling [...]>
Download (untitled) / with headers
text/plain 1.7k
I ran into an issue where the formatCode was overwritten with an empty value in The fix was in __load_styles to add an existence check into the loop over @styles: ---    2020-04-24 21:07:50.027756593 +0000 +++    2020-04-24 22:31:25.438635988 +0000 @@ -225,6 +225,7 @@ sub __load_styles {          my $default = $1 || '';          foreach my $t1 (@styles) { +            if (!exists($style_info{$t1})) {              $member_styles->contents =~ /numFmtId="$t1" formatCode="([^"]*)/;              my $formatCode = $1 || '';              if ($formatCode eq $default || not($formatCode)) { @@ -240,6 +241,7 @@ sub __load_styles {              $style_info{$t1} = $formatCode;              $default = $1 || '';          } +        }      }      return (\@styles, \%style_info); The issue occurred with an .xlsx file with the following definitions:     <numFmts count="1">         <numFmt numFmtId="164" formatCode="00000" />     </numFmts>     <cellXfs count="14">         <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" />         <xf numFmtId="164" fontId="16" fillId="0" borderId="0" xfId="0" applyNumberFormat="1" applyFont="1" />         <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1" />         <xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1" applyAlignment="1">         ...     </cellXfs> Ultimately the $formatCode was being overwritten due to $default being set. I was unsure what the purpose of $default was so my fix was to use the existence check. Hopefully you can apply this fix. Best, Marcus

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to