Forum > Beginners

Save as XLSX file

(1/1)

seghele0:
Would like to have a name and date in the file name.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---workbook.WriteToFile('Wiezen.xlsx', sfOOXML, true);
Result: Wiezen-21092021.xlsx
(ddmmyyyy)

Thanks.
 ;)

Zvoni:
Huh?
Use the Date-Function? https://www.freepascal.org/docs-html/rtl/sysutils/date.html
and build your filename by concatenating everything together?

seghele0:
Can there be an example, plese.

wp:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  filename: String;...  filename := 'Wiezen-' + FormatDateTime('ddmmyyyy', Date);// or even://  filename := FormatDateTime('"Wiezen-"ddmmyyyy', Date);  workbook.WriteToFile(filename, sfOOXML, true); 

seghele0:
Wp, thank you for the code.
 :)

Navigation

[0] Message Index

Go to full version