[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CF-Dev] OT: Quick and dirty -- view HTML in Excel



We have some HTML reports that users are used to being able to save to
their desktop from IE's Save As and open in Excel -- as the output is
all table-based, it's displays great.

We've moved to creating the files on the server with XML and XSLT and
although the reports are still HTML (albeit xhtml), they now include an
XML declaration. If you save the HTML file to your desktop from IE, and
then open it in Excel, with the xml declaration Excel starts displaying
it (presumably trying to parse it as xml) as:

 /html
 /body/div/#id		/body/div/@class		[snip]

and throws a wobbly saying

 "This XML file cannot be opened because of an error. Check to make sure
the file is a valid XML file,
 and that the XML syntax is correct. [snip]"

I'm pretty sure the file *is* valid xml, as you can change the extension
to .xml and drag it into IE and it displays fine, so I suspect it's
something else that's causing Excel problems. If you remove the xml
declaration:

 <?xml version="1.0" encoding="utf-8"?>

it opens fine in Excel. I've also tried adding (with the xml declaration
in place):

 <META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

to see if that persuades Excel to display it as HTML but no dice.

Is there anything that can be added to the xhtml file so that Excel
displays it as HTML? And we're only after a quick and dirty, so
"generate a spreadsheet on the server and spit that out" isn't an option
right now (and the other developer here is keen not to remove the XML
declaration in case that causes more problems, although what they might
be, I can't rightly say).


Thanks

-- 
Aidan Whitehall   aidanwhitehall@fairbanks.co.uk
Macromedia ColdFusion Developer
Fairbanks Environmental   +44 (0)1695 51775

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________