Title:
Excel spreadsheet generation and formating issue, value are not returned correctly
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Greg Heh / Greg Heh (Greg Heh)
Created: 05/13/2015
Components: Document Management, Office Integration
Versions: 11.0
Failure Type: Incorrect w/Workaround
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / Few users will encounter
Locale/System: English / Win 2012 Server x64
Vote Count: 0
Problem Description:
When generating an excel document that includes numeric value strings, including hyphens (-), formatting those values to 'General' or 'Text' causes all digits before the hyphen to be dropped from the value.
Steps to Reproduce: When running the following code, a value such as 224-1 gets incorrectly rendered as -1
<cfquery name="getrpt" datasource="#request.db.dsn#">
SELECT
'224-1' as shipment_name
FROM dual
</cfquery>
<cfset sObj = SpreadsheetNew("true")>
<cfset SpreadsheetAddRows(sObj, Evaluate("getrpt"))>
<cfset SpreadsheetFormatCellRange(sObj, {dataformat="General"}, 1, 1, Evaluate("getrpt.recordcount + 2"), 1)>
<cfset DateNum = Int((NOW() - DateFormat(NOW(), "yyyy-mm-dd")) * 999999)>
<cfset filename = "Export_#DateNum#">
<cfset fullfilepath = "#GetDirectoryFromPath(GetCurrentTemplatePath())#/#filename#.xlsx">
<cfspreadsheet action="write" filename="#fullfilepath#" name="sObj" sheetname="Exported Data">
<cffile action="readbinary" file="#fullfilepath#" variable="export_file">
<cffile action="delete" file="#fullfilepath#">
<cfheader name="Content-Disposition" value="inline; filename=#filename#.xlsx">
<cfcontent type="application/vnd.msexcel" reset="true" variable="#toBinary(export_file)#">
If you do not specify any formatting, the value will display as #####. The number of hash's will fill any width you resize the cell to.
Actual Result: cell value of: -1 or ######## depending on format applied to cell.
Expected Result: cell value of 224-1
Any Workarounds:
None
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3987544
External Customer Info:
External Company:
External Customer Name: Greg
External Customer Email:
External Test Config: My Hardware and Environment details:
CF version 11.0.05.293506
Edition: Enterprise
OS: Windows Server 2012
OS Version: 6.2
Update level /C:/Coldfusion11/cfusion/lib/updates/hf1100-3971083.jar
Adobe Driver Version: 5.1.3 (Build 000094)
Generating an .xlsx spreadsheet to an Excel 2013 application.
Attachments:
Comments: