Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

spreadsheet set createdate

New Here ,
Nov 24, 2010 Nov 24, 2010

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.

TOPICS
Advanced techniques
386
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 26, 2010 Nov 26, 2010
LATEST

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">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources