Copy link to clipboard
Copied
Hi, excuse my poor english.
I need some help with spreadsheet.
When I create a sheet with spreadsheetNew() function, the createdate information was an empty field.
I don't find how I can put this date by myself, of with a dedicaded function.
spreadsheetAddInfo() dont expose this possiblity..
Do you have an ideas ?
Thanks in advance.
Copy link to clipboard
Copied
I could be wrong, but I do not think there is a documented way to add the date for .xls files. You can use the underlying POI object to add the date. Unfortunately it requires saving the file to disk twice. But it does work. Edit: You can probably do it in a single step. If you have access to createObject("java")
<!--- create a sample file --->
<cfset outPath = ExpandPath("./testFile.xls")>
<cfset sheet = SpreadsheetNew()>
<cfset spreadsheetSetCellValue(sheet, "foo", 1, 1)>
<cfset spreadsheetWrite(sheet, outPath, true)>
<!--- read file again. add the date. save it to disk --->
<cfset sheet = SpreadSheetRead(outPath)>
<cfset info = sheet.getWorkbook().getSummaryInformation()>
<cfset info.setCreateDateTime( now() )>
<cfset spreadsheetWrite(sheet, outPath, true)>
<!--- test results --->
<cfset sheet = SpreadSheetRead(outPath)>
<cfdump var="#SpreadsheetInfo(sheet)#" label="New Summary Information">