ColdFusion11: CFContent not writing file with open excel file

I am trying to perform a simple task in ColdFusion: create an excel file and upload it in a browser. I have it:

<cfset local.sheet = SpreadsheetNew("My Spreadsheet", "true") />
<cfset SpreadsheetAddRow(local.sheet, "Col1,Col2,Col3") />

<cfheader name="content-disposition" value="attachment;filename=NiceName.xlsx" />
<cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" variable="#spreadsheetReadBinary(local.sheet)#" reset="true" />

Which worked fine on CF9, however it does not apply to CF11. Opening the file, he says:

Die Datei 'NiceName.xlsx' kann von Excel nicht geöffnet werden, da das Dateformat oder die Dateierweiterung ungültig ist. Überprüfen Sie, ob die Datei beschädigt ist und ob die Dateierweiterung dem Dateiformat entspricht.

This means something like:

Excel cannot open the "NiceName.xlsx" file because either the file format or its value is invalid. Please check if the file is damaged and the end of the file matches the file format.


I can:

  • <cfmailparam> sheet and receive the file by mail.
  • <cfspreadsheet action="write"> sheet and get the file on the server.

.


:

  • <cfspreadsheet action="write">, <cfcontent file="#pathToFile#">, .
  • IIS URL-Rewrite-Rules.
  • IIS MIME- .xlsx. , .
  • <cfabort>, .

.


:

  • ColdFusion 11 (11,0,0,289974) Tomcat 7.0.52.0
  • 64- Windows Server 2008 R2
  • Microsoft Office 2013
  • IIS 7.5.7600.16385
+4
1

application/vnd.ms-excel openoffice. mime. , openoffice, , . , .

0

All Articles