Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
<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
Copy link to clipboard
Copied
can u pls elaborate little more on how to go about it ?
Copy link to clipboard
Copied
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
<cfspreadsheet>
http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec17cba-7f87.html
Google:
https://www.google.co.uk/search?q=cfspreadsheet
--
Adam
Copy link to clipboard
Copied
The following information is meant for the website developer for debugging purposes. | |||
Error Occurred While Processing Request | |||
A tag starting with 'CF' has been detected. This tag is not supported by this version of ColdFusion. Please verify your typo and try again.
|
Copy link to clipboard
Copied
Come on, help yourself a bit here. Just because you've asked for help on a forum doesn't mean you can then switch-off your brain and do no troubleshooting at all yourself.
Did you read the docs for <cfspreadsheet>? What version of CF was it added in? What version of CF are you running? Even the error message gives a very strong clue as to what the story is here:
This tag is not supported by this version of ColdFusion
So you're using CF8 or lower (if you're using an obsolete version of CF, you really ought to mention this in your initial post), so <cfspreadsheet> is not available to you.
So you'll need to use POI. Google it. Hint: Ben Nadel has written a CF wrapper for it.
--
Adam