Skip to main content
gokul1242
Inspiring
May 25, 2013
Question

cfprocessingdirective pageencoding also not working

  • May 25, 2013
  • 1 reply
  • 1459 views

Hi

I use the below code to export the data from ldap query to excel

<cfheader name="Content-Disposition" value="attachment; filename=Report.xls">

<cfcontent type="application/vnd.ms-excel">

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

But special characters appears as (?) symbol is excel sheet even though it displays correctly in browser

In Browser:


In Excel:

I even tried using <cfprocessingdirective pageencoding="utf-8" />

But still it appears same..

Pls advice

This topic has been closed for replies.

1 reply

Inspiring
May 25, 2013

<cfprocessingdirective> is irrelevant here, as it only relates to the source code of the file being compiled, not any data being processed.

<meta> tags are browser instructions, and as you're specifically telling the browser not to deal with this response, that's not going to help either. Try setting the encoding as an HTTP header (so with <cfheader> rather than with a meta tag.

That said, if you want an XLS file, simply sending text and saying "it's XLS" is not a good approach. Use CF's XLS-creation functions or POI to crate an actual XLS file.

--

Adam

gokul1242
gokul1242Author
Inspiring
May 26, 2013

can u pls elaborate little more on how to go about it ?

Inspiring
May 26, 2013

There are plenty of docs out there on how to use <cfheader> and CF's spreadsheet functions. I'm not gonna write your code for you. However if you write some code and have issues, and post back with a question, I'll keep an eye out for you.

CFHEADER:

http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7aea.html

Spreadsheet functions

http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html#WSaad0660b0585370c-3b13488c12d7e9aabe0-8000

<cfspreadsheet>

http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec17cba-7f87.html

Google:

https://www.google.co.uk/search?q=cfspreadsheet

--

Adam