On 1-Jun-07, at 12:20 PM, b...@cpan.org wrote:

Last time I tried to create Excel files with a script, I ended up
reverse engineering the XML format produced by Excel to create an
XML file that Excel would read back correctly, if the webserver sent
the appropriate MIME type (application/vnd.ms-excel).

As an added bonus, I could even do some coloring.

I ended up doing it by generating HTML (this had the additional advantage of generating something useful in a browser as well). Of course you have to be very careful with the HTML you produce, as if you try and make it too, say, standards compliant Excel goes "woah! this isn't really an Excel file.... let's treat it as HTML! And kill it!".

If you do manage to keep to the right bits of HTML and the right elements in the right places you can end up with a straight HTML file with a .xls file extension (and served with the above mime-type) that behaves exactly like a (binary) .xls file.

I also didn't do graphs, but I did do rotated text iirc, this was to generate reports that had to look pretty. On paper. Yeah, there's a whole layer of hate I'm leaving out here.

~patrick

Reply via email to