Cfcontent type excel not working

I am porting over a CF app to Lucee, and I cant get a page to generate to excel. It only allows it to go to a CFM file. I feel like Im missing something simple like a config setting or something, just not sure what.

The code Im using is <cfcontent type="application/msexcel">

<cfcontent> by itself won’t do anything about the file name the data is served as, even on CF. So I think you’re not sharing all the relevant code.

You need <cfheader> to change the file name, something along the lines of:

<cfcontent type="application/vnd.ms-excel" >
<cfheader name="Content-Disposition" value="filename=fehlmenge2.xls">

(Full disclosure, I just googled “how to serve an XLS file using CFML” and that was in the first result, but that looks about right).

dang it, I knew this was something dumb! The existing CF application doesnt have the CFHEADER line, I foolishly overlooked that as the culprit. Works fine now that I added it. Thank you

2 Likes