In general a standard palette is used but it can be redefined by the user. As such, colour index 42 may be red in one workbook and green in another.
SaveParser doesn't try to map the colour palette between the original and target workbooks (which is a bug) so this may be causing the effect that you are experiencing.
You can try work around the issue as follows:
#!/usr/bin/perl use strict; use warnings; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my $parser = Spreadsheet::ParseExcel::SaveParser->new(); my $template = $parser->Parse('color01.xls'); # Get the underlying Spreadsheet::WriteExcel workbook. my $swe_workbook = $template->SaveAs('color02.xls'); # Map the original color palette to the new workboook. for my $i ( 8 .. 63 ) { $swe_workbook->set_custom_color( $i, '#' . $parser->ColorIdxTo +RGB($i) ); }
See the Spreadsheet::WriteExcel docs for more information on Colours in Excel.
Update: I've logged this issue on rt.cpan.org.
--
John.
In reply to Re: ParseExcel::SaveParser, colors & google docs
by jmcnamara
in thread ParseExcel::SaveParser, colors & google docs
by irDanR
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |