Question

I'm using Perl v5.12.3 on Mac OSX Lion. I'm using the latest version of the Spreadsheet::XLSX module. How do you copy existing worksheet row, column, and cell formats from one XLSX file to a new file? For cells, I'm currently trying

                        my $cell = $oldWorksheet -> {Cells} [$row] [$col];
                        ...
                        $newWorksheet->write( $newWorksheetCurRow, $col, $val, $cell->{Format} )

But it isn't working. For example, the background colors aren't getting copied and I don't even think "{Format}" is a valid attribute of the cell.

Was it helpful?

Solution

Spreadsheet::XLSX doesn't read cell formats so it isn't possible to copy a worksheet formatting like this.

As far as I know there isn't any Perl module, apart from Win32::OLE that reads formatting from an XLSX file.

I'm working on one but formatting support is several months away.

OTHER TIPS

If it's like SpreadSheet::WriteExcel/ParseExcel, then you have to do it all manually. That is, create a new format on the writer side, then copy in all the attributes of the format from the parsed side.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top