tracker issue : CF-4014690

select a category, or use search below
(searches all categories and all time range)
Title:

Exporting HTML to Excel

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Carlos Alonso / Carlos Alonso (Carlos Alonso)

Created: 06/30/2015

Components: General Server

Versions: 11.0

Failure Type: Usability Issue

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win 2012 Server x64

Vote Count: 1

Problem Description:

When streaming HTML content via CFHEADER/CFCONTENT tags to Excel, an error message is displayed stating "The file format and extension of [file_name.xls] do not match. The file could be corrupt or unsafe." and the actual HTML code is displayed in the resulting Excel spreadsheet. We just migrated from CF8.01 to CF11 and the exact same code would produce the spreadsheet with the HTML code rendered as a pseudo-Excel spreadsheet.

Steps to Reproduce:

Create a .cfm file with
<CFCONTENT TYPE="application/msexcel">
<CFHEADER NAME="Content-Disposition" VALUE="inline;filename=file_name.xls">

Create an HTML table with a few rows and columns.

Actual Result:

The actual HTML code the ColdFusion produces is displayed in the Excel spreadsheet.

Expected Result:

The rendered HTML table with the columns and rows should appear.

Any Workarounds:

Including the tag <CFSETTING ENABLECFOUTPUTONLY="Yes"> seems to help but still results in any formatting applied to the table's <TD> being lost.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4014690

External Customer Info:
External Company:  
External Customer Name: Carlos
External Customer Email:  
External Test Config: My Hardware and Environment details:



ColdFusion 11,0,04,293328

Windows Server 2012

Attachments:

  1. July 01, 2015 00:00:00: 1_Actual_Result.jpg
  2. July 01, 2015 00:00:00: 2_Improved_Result_with_ENABLECFOUTPUTONLY_YES.jpg

Comments:

I tried using various Content Type values for Excel without success.
Comment by External U.
6809 | June 30, 2015 08:38:36 PM GMT
Carlos, I just tried to reproduce this, and see slightly varying results. Firstly, I do get the "The file format and extension of [file_name.xls] do not match" error. We will get this fixed. Secondly, In my case, an non-formatted excel is displayed if <CFSETTING ENABLECFOUTPUTONLY="Yes"> is NOT included. And, with <CFSETTING ENABLECFOUTPUTONLY="Yes">, the excel fails to display anything at all. Can you also mention the platform / connector with which you are seeing this issue?
Comment by Immanuel N.
6810 | July 30, 2015 11:08:31 PM GMT
Hi Immanuel, I see the same result as you. Non-formatted excel is displayed if the cfsetting is not included. If the cfsetting is included, then excel fails to display anything at all. Verified on Win10 w/ IIS 10 w/ CF11 Update 5 (build 11,0,05,293506). Thanks!, -Aaron
Comment by External U.
6811 | September 30, 2015 02:10:36 AM GMT
+1 ......................
Vote by External U.
6819 | September 30, 2015 02:10:50 AM GMT
Hi, As per the code, we are trying to render html via spreadsheet. Coldfusion CFCONTENT dosen't manipulate the data being streamed. Below is the link from Microsoft https://support.microsoft.com/en-us/kb/948615 Microsoft Office has introduced validation on file content and extension in Microsoft Office Excel 2007 or later , if it doesn't match we see warning, which is valid in this scenario as we are rendering html table in excel.
Comment by Mayur J.
6812 | November 19, 2015 07:58:48 AM GMT
@Aaron, Correction on my earlier comment. I do not see issues with the <CFSETTING ENABLECFOUTPUTONLY="Yes">. Do you still see this issue? If yes, can you please provide the code snippet? Also, as mentioned in the below comment, we will not be treating the error thrown in excel as a bug.
Comment by Immanuel N.
6813 | November 20, 2015 03:50:12 AM GMT
Hi Immanuel, Thanks for the follow-up. When running the following, then clicking "YES" on the Excel error message (same error message from this ticket's description), then Excel just displays a blank/unpopulated spreadsheet. <CFSETTING ENABLECFOUTPUTONLY="Yes"> <CFCONTENT TYPE="application/msexcel"> <CFHEADER NAME="Content-Disposition" VALUE="inline;filename=file_name.xls"> <table> <tr> <th>first</th> <th>second</th> <th>third</th> <th>fourth</th> </tr> <tr> <td>a</td> <td>b</td> <td>d</td> <td>d</td> </tr> <tr> <td>e</td> <td>f</td> <td>g</td> <td>h</td> </tr> </table> Thanks!, -Aaron
Comment by External U.
6814 | November 20, 2015 08:06:23 AM GMT
Aaron, The tag, ENABLECFOUTPUTONLY, would only output content enclosed under a <cfoutput> tag. You can wrap the table with a cfoutput tag. and see the excel to be populated.
Comment by Immanuel N.
6815 | December 03, 2015 09:33:22 PM GMT
Hi Immanuel, You're right; my fault. Thanks for the correction. Thanks!, -Aaron
Comment by External U.
6816 | December 04, 2015 02:04:57 AM GMT
Thanks for confirming, Aaron. @Carlos, can you please revert if you still see this issue?
Comment by Immanuel N.
6817 | December 04, 2015 05:49:33 AM GMT
Closing the bug as Withdrawn > NotABug, since we do not have a handle on the error thrown by excel, as mentioned below, and excel formatting / populate issues do not exist.
Comment by Immanuel N.
6818 | December 14, 2015 01:57:37 AM GMT