SpreadsheetFormatColumns no work that goes wrong?

Server: CF10

Platform: Windows and Linux (Win in windows DEV in PROD)

I'm so generate this impressive excel file for a client but to get the date fields to behave properly. Everything seems to work perfectly, but when I send data to excel to be generated, excel treats it as any text and when it filed gets sorted it manages it as such.

More information: the column I'm trying to set up is called Date of arrival it is happen to mm/dd/yyyy format (I tried to format is d/m/YY, but when it happens in the sheet that does not work as well)

I also included a picture of the sorted row. It don't think it's valid, but it is not just sort in chronological order.

DateSort.PNG

Code:

("< cfset expandPath("./TDYData_(#DateFormat(now(),'mmddyy')#).xls = filename ") >

<! - make an object worksheet - >

< cfset s = spreadsheetNew ("TDYData") >

<!--> Add a header line

< cfset

<!--> format header

< cfset spreadsheetFormatRow (s,

{

"BOLD" = true,

fgColor = "lemon_chiffon."

FontSize = 10

},

(1) >

<!--> append query

< cfset spreadsheetAddRows (s, myExcel) >

< cfset SpreadSheetAddFreezePane (s, 0, 1) >

< cfset spreadsheetFormatColumn (s, {dataformat = "d/m/yy"}, 17) / >

< cfset spreadsheetFormatColumn (s, {align = "right"}, 16) / >

< name cfheader = "content-disposition" value = "attachment; filename = TDY_Data_ (#DateFormat (now (), 'MMDDYY') #) .xls ">"

< cfcontent type = "application/msexcel" variable = "#spreadsheetReadBinary (s)" # "reset ="true">"

Any ideas?

Thank you

In my view, that the question is because you do not use SpreadsheetSetCellValue() to enter data.  He will respect your dataFormat.

It's kind of a pain to enter manually (via cfoutput and cfloop) data in the cells, but it gives you more granular control over things like formatting and others.

In addition, if you use integers (integers only) in all cells, it will appear as though that is inserted as text, too.  You will need the dataformat, insert data and position the dataformat, once again.  Weird, I know, but it works.

HTH,

^_^

Tags: ColdFusion

Similar Questions

Maybe you are looking for