Recent

Author Topic: Save as XLSX file  (Read 1248 times)

seghele0

  • Full Member
  • ***
  • Posts: 173
Save as XLSX file
« on: September 21, 2021, 04:14:21 pm »
Would like to have a name and date in the file name.

Code: Pascal  [Select][+][-]
  1. workbook.WriteToFile('Wiezen.xlsx', sfOOXML, true);

Result: Wiezen-21092021.xlsx
(ddmmyyyy)

Thanks.
 ;)

Zvoni

  • Hero Member
  • *****
  • Posts: 2316
Re: Save as XLSX file
« Reply #1 on: September 21, 2021, 04:22:58 pm »
Huh?
Use the Date-Function? https://www.freepascal.org/docs-html/rtl/sysutils/date.html
and build your filename by concatenating everything together?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

seghele0

  • Full Member
  • ***
  • Posts: 173
Re: Save as XLSX file
« Reply #2 on: September 21, 2021, 05:20:12 pm »
Can there be an example, plese.

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Save as XLSX file
« Reply #3 on: September 21, 2021, 05:37:18 pm »
Code: Pascal  [Select][+][-]
  1. var
  2.   filename: String;
  3. ...
  4.   filename := 'Wiezen-' + FormatDateTime('ddmmyyyy', Date);
  5. // or even:
  6. //  filename := FormatDateTime('"Wiezen-"ddmmyyyy', Date);
  7.   workbook.WriteToFile(filename, sfOOXML, true);
  8.  

seghele0

  • Full Member
  • ***
  • Posts: 173
Re: Save as XLSX file
« Reply #4 on: September 22, 2021, 09:13:01 am »
Wp, thank you for the code.
 :)

 

TinyPortal © 2005-2018