Here's some code snippets for an example:
theSheet = SpreadsheetNew("Rates","True");
SpreadsheetAddRow(theSheet,"4A,4B,4C,4D,4E,4F,4G,4H,4I,4J");
SpreadsheetAddRow(theSheet,"4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T");
SpreadsheetAddRow(theSheet,"4U,4V,4W,4X,4Y,4Z,4D4,4F4");
and
<cfheader name="content-disposition" value="attachment; filename=#GetTickCount()#.xlsx">
<CFHEADER NAME="Expires" VALUE="#now()#">
<cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" variable="#SpreadsheetReadBinary(theSheet)#"/>
The issue is that "4D" and "4F" (and not the others) lose the 'D' and 'F' and are formatted as a number.
I tried this:
formatText = StructNew();
formatText.dataformat="@";
SpreadsheetFormatColumns(theSheet,formatText,"1-10");
I verified that this set the format in Excel to "Text", but now I just see the number 4 in a Text-formatted cell! I also tried using the ' character, but when it opens in Excel, it just shows the ' instead of literalizing the cell.
This is rather strange; anybody have an idea about what's going?
It seems that a workaround is to set the cell formula to be the literal "4D".
theSheet = SpreadsheetNew("Rates","True");
SpreadsheetAddRow(theSheet,"4A,4B,4C,,4E,,4G,4H,4I,4J");
SpreadsheetSetCellFormula(theSheet, """4D""", 1, 4);
SpreadsheetSetCellFormula(theSheet, """4F""", 1, 6);
SpreadsheetAddRow(theSheet,"4K,4L,4M,4N,4O,4P,4Q,4R,4S,4T");
SpreadsheetAddRow(theSheet,"4U,4V,4W,4X,4Y,4Z,4D4,4F4");
I still don't know why this is happening, but my idea is that SpreadsheetAddRow() and SpreadsheetSetCell() are interpreting 4D and 4F as numeric and are interpreting the D and F and suffixes standing for Double and Float, and stripping them out after conversion.
You can submit the bug to Adobe by going to https://bugbase.adobe.com/index.cfm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With