Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Output to Excel doesn't work as Excel

9 views
Skip to first unread message

Kirill Medvedev

unread,
Feb 27, 2014, 1:57:43 AM2/27/14
to
Hi,

I'm trying to make current page's contents (which is a table) to be saved as an .xls file.

My code looks like this:
======================
<cfsavecontent variable="pageContent">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
<cfoutput>...</cfoutput>
</body>
</html>
</cfsavecontent>

<cfheader name="Content-Disposition" value="attachment;filename=myfile.xls">
<cfcontent type="application/ms-excel" variable="#ToBinary(ToBase64(pageContent2))#">
=========================
The file downloads as required, but it is not actually an Excel file, it's a HTML page in a file with .xls extension. The page opens normally in the browser if the extension is changed, and contains all necessary data... it's just not Excel. I tried to change cfcontent's parameter into type="application/msexcel", vnd.ms-excel, x-msexcel, and even application/application/ms-excel (saw that one somewhere when searching for solution). Nothing works. The file is still a disguised HTML page.

What am I doing wrong?

Thanks in advance.
0 new messages