Kirill Medvedev
unread,Feb 27, 2014, 1:57:43 AM2/27/14You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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.