Subject: | WriteExcel: generates bad Excel files |
Date: | Fri, 10 Nov 2006 12:40:06 -0500 |
To: | bug-Spreadsheet-WriteExcel [...] rt.cpan.org |
From: | "J.D. Baldwin" <baldwin [...] panix.com> |
I am getting repeated, and repeatable, corrupt file generation with
WriteExcel on a certain data set. I am unable to isolate exactly why
this particular data set creates corrupt files when other, similar,
data does not. The data is imported using XML::Simple::XMLin, but
the strings to be written are simple lists of IPs separated by newlines.
I tested using Excel 2003 SP 2, which simply reports that the file was
corrupt and a repair was attempted. Sometimes the first column of
data is shown, and sometimes nothing at all is shown. Loading the
same spreadsheet into StarOffice 7 (Product Update 4) shows "*** ERROR
IN SST ***," in many cells, along with other data corruption. Based
on other results, the corruption does not depend solely on the length
of the strings written into the cells.
This is the part that's driving me nuts: IF I WRITE THE SAME STRINGS
DIRECTLY TO A SPREADSHEET, IT WORKS! But if I write the data read in
from the XML file, it's corrupt. I can't figure it out; maybe you
can.
My automatically generated system details are as follows:
Perl version : 5.006001
OS name : solaris
Module versions: (not all are required)
Spreadsheet::WriteExcel 2.17
Parse::RecDescent 1.94
File::Temp 0.17
OLE::Storage_Lite 0.14
IO::Stringy 2.110
The original program imports an XML representation of a Checkpoint
FW-1 rulebase and outputs a spreadsheet. I have removed all
formatting and extraneous fields, both from the original program and
from the data set, for simplicity. I boiled it down to the minimal
bad data set, attached as BAD.xml. If you remove just one fake IP
from that list, it works OK. I have included that file as GOOD.xml.
The program, included as generate.pl, takes an XML file as its one
argument, and outputs a spreadsheet file of the same name with
extension .xls. In case you cannot run the program for some reason
(XML::Simple is non-trivial to get working), I have attached
result spreadsheets GOOD.xls and BAD.xls.
All files are attached in a small .tar.gz file. Let me know if I can
provide any other samples or information. This is an excellent little
tool and I'd jlike to be able to use it for my project.
jd
Message body not shown because it is not plain text.