Title:
<CFSPREADSHEET> generates a file with data corrupted. SPREADSHEETNEW() does not.
| View in TrackerStatus/Resolution/Reason: Closed/Won't Fix/AsDesigned
Reporter/Name(from Bugbase): Stephen Johnson / Stephen Johnson ()
Created: 05/04/2017
Versions: 11.0
Failure Type: Data Corruption
Found In Build/Fixed In Build: 11,0,11,301867 /
Priority/Frequency: Normal / Few users will encounter
Locale/System: ALL / Win 2012 Server x64
Vote Count: 0
Problem Description: I validated that this bug goes back to CF 9. Assume that an XLSX is being generated on the basis on a query where one of those query values happens to be an integer followed by an 'f' or a 'd', for example '234123f'. From a CF perspective these values should be interpreted as strings (VARCHAR). Opening up the XLSX in Excel or inspecting the XML in the XLSX archive post generation shows a value of '234123' not '234123f'. From what I can tell CF is not translating '234123f' to a Java String class, but to a Java float, 234123f, or Java double 234123d. Interestingly, SPREADSHEETNEW() and SPREADHSHEETADDROWS() works fine, even when you don't assign a datatype.
Steps to Reproduce:
<cfscript>
qTemp = queryNew("ID,NAME,MYVALUEFLOAT,MYVALUEDOUBLE","INTEGER,VARCHAR,VARCHAR,VARCHAR");
queryAddRow(qTemp);
querySetCell(qTemp,"ID",1);
querySetCell(qTemp,"NAME","WTF");
querySetCell(qTemp,"MYVALUEFLOAT","11f");
querySetCell(qTemp,"MYVALUEDOUBLE","11d");
cfspreadsheet(action="write", filename="c:\download.xlsx", query="qTemp", overwrite=false);
</cfscript>
versas
<cfscript>
qTemp = queryNew("ID,NAME,MYVALUEFLOAT,MYVALUEDOUBLE","INTEGER,VARCHAR,VARCHAR,VARCHAR");
queryAddRow(qTemp);
querySetCell(qTemp,"ID",1);
querySetCell(qTemp,"NAME","WTF");
querySetCell(qTemp,"MYVALUEFLOAT","11f");
querySetCell(qTemp,"MYVALUEDOUBLE","11d");
xSpreadSheet = SpreadsheetNew("mySpreadSheet", true);
datatype = [""];
spreadsheetAddRows( xSpreadSheet, qTemp,1,1,"true",datatype);
spreadsheetWrite(xSpreadSheet, "c:\download.xlsx","true");
</cfscript>
Actual Result: See above
Expected Result: See above
Any Workarounds: Don't use CFSPREADSHEET or move onto Lucee.
Attachments:
Comments: