5 Replies Latest reply on Jun 22, 2013 6:07 AM by BKBK

    ex

    newcf

      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

        • 1. Re: ex
          BKBK Adobe Community Professional & MVP

          What about this one:

           

           

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

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

          • 2. Re: ex
            Big Mad Kev Level 1

            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.

            • 3. Re: ex
              BKBK Adobe Community Professional & MVP

              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!

              • 4. Re: ex
                Big Mad Kev Level 1

                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-XM L.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-Ex cel-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.

                • 5. Re: ex
                  BKBK Adobe Community Professional & MVP

                  Sorry, it wasn't my intention to throw fire in your direction. There are certainly good points in your suggestion. We only differ in point of view.