cfspreadsheet can I format columns to text when creating new doc.
Here is my issue. I have a column of data I am attempting to write using cfspreadsheet. The data in the column is a client's identification code for a shipment. The format they use is two numeric one alpha five numeric, example 01E23456. Lots of their shipments use E for the alpha character. When I write this to the new excel spreadsheet it ends up doing something to the data. When I open the Excel Spreadsheet I get an error, "File error: data may have been lost." Looking at the data in the column any value using E as the alpha character become "#NUM!" in the spreadsheet.
Here is the code I'm using.
<cfset SpreadsheetObj = SpreadsheetNew()>
<cfset spreadsheetAddRows(SpreadsheetObj,resultData)>
<cfspreadsheet action="write" filename="#theFile#" name="SpreadsheetObj" sheet=1 sheetname="Invoice" overwrite=true></cfspreadsheet>
I have tried the following to correct this issue without success.
Settings the column format using the following code.
<cfscript>
formatText=StructNew();
formatText.dataformat="Text";
</cfscript>
<cfset SpreadsheetFormatColumns(SpreadsheetObj, formatText, "19") />
This did not correct the issue.
Appending an apostrophe to the front of the cell data when grabbing it from MySQL, suggestion for avoiding this issue in Excel via MS Forums. This corrected the error I was getting when opening the spreadsheet but left the apostrophy in front of the field example '01E23456.
Checking the raw data in the .xls I am unable to find any of the data where an E was used for the alpha character but can find other data from the same field. When I tested adding the apostrophy I was able to find all of these records.
Has anyone else come across this issue and come up with a solution?
