Skip to main content
Known Participant
June 21, 2013
Question

ex

  • June 21, 2013
  • 2 replies
  • 818 views

Hi,

I have the query results and try to dump it into csv or txt file but have troubled with data because lot of stuffs from description field.  Excel is the only solution but when i click on the excel link and click OK button,  i got this message below

"the file you are trying to open, excelReport.xls  is in a different format than specified by the file extension ......"

After clicking on Yes the file opens properly, but i don't want this msg to appear.

i have MX Excel 10 and coldusion 7, is there the way to get rid of message?

<cfcontent type="application/msexcel">

<cfheader name="Content-Disposition" value="filename=BrightIdea.xls">

<cfloop query="variables.qReport">

....

</cfloop>

Thanks

    This topic has been closed for replies.

    2 replies

    Big Mad Kev
    Participating Frequently
    June 22, 2013

    Sadly not as you're generating this file as a HTML file which Excel is able to interpret as a Excel File.

    The only way I would suggest to upgrade to a supported version of ColdFusion like 9 or 10 and use CFSPREADSHEET this would be the best way to resolve the issue you have.

    BKBK
    Community Expert
    Community Expert
    June 22, 2013

    Big Mad Kev, you mean, to get rid of an annoying message, he should buy and install a new application server? Talk about the tail wagging the dog!

    Big Mad Kev
    Participating Frequently
    June 22, 2013

    I'm saying this isn't a ColdFusion issue it's how the data is rendered, what I am saying is that using a solution like CFSPREADSHEET will resolve the issue and keep it just as easy as ColdFusion has always done made hard things easy and in the latest supported versions they put effort in doing this for Excel documents.

    He could also look at something like: http://www.bennadel.com/blog/461-Creating-Microsoft-Excel-Documents-With-ColdFusion-And-XML.htm which may be more involved then you need.

    Or even: http://www.bennadel.com/blog/474-ColdFusion-Component-Wrapper-For-POI-To-Read-And-Write-Excel-Files.htm

    Both these solutions will help him create native Excel Documents, if he is using Excel 2007+ then he can generate the XML files for the excel file and then zip it up with an extension of xlsx.

    Just saying that ColdFusion 7 isn't a support platform and came out over 8 years ago in 2005 and so he wants to do things with the latest version of excel then use the latest version of the App Server or roll your own as above.

    Just giving some guidance, but of course if that's wrong and I get burned for giving adivce I'll leave now.

    BKBK
    Community Expert
    Community Expert
    June 22, 2013

    What about this one:

    <cfheader name="Content-Disposition" value="inline; filename=BrightIdea.xls">

    <cfcontent type="application/vnd.msexcel">