1 Reply Latest reply on Nov 27, 2010 12:41 PM by -==cfSearching==-

    spreadsheet set createdate


      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.

        • 1. Re: spreadsheet set createdate
          -==cfSearching==- Level 4

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