oAbout = new ActiveXObject("SLNKXLSX.About");
WScript.Echo(oAbout.DLLPath);
WScript.Echo(oAbout.VersionString);

var oExcel = new ActiveXObject("SLNKXLSX.Excel");

var filename = "hello_world.xlsx"

var oWb = oExcel.workbook_new(filename);
var oWs = oWb.add_worksheet("Sheet1");

oWb.set_property("author", "Jos Groot Lipman");
oWb.set_property("title", "De titel");
oWb.set_property("comments", "Created with Facilitor v{0}");

oWs.write_string(7, 0, "DLLPath", 1);
oWs.write_string(7, 1, oAbout.DLLPath);
oWs.write_string(8, 0, "VersionString", 1);
oWs.write_string(8, 1, oAbout.VersionString);


oWs.write_string(0, 0, "Tekst met Euro €", 1);
oWs.write_comment(0, 0, "Commentaar € met Euro");
oWs.write_string(0, 1, "Number", 1);
oWs.write_string(0, 2, "Currency", 1);
oWs.write_string(0, 3, "Datum", 1);
oWs.write_string(0, 4, "DatumTijd", 1);
oWs.write_string(0, 5, "Tijd", 1);
oWs.write_string(0, 6, "Datum 2", 1);
oWs.write_string(0, 7, "Datum in 1966", 1);
oWs.write_string(0, 8, "Datum in 2024", 1);

oWs.write_string(1, 0, "Een tekst");
oWs.write_number(1, 1, 5678);
oWs.write_number(1, 2, 123.45, 1);
oWs.write_unixtime(1, 3, new Date().getTime() / 1000, 0); // zonder tijdzone?
oWs.write_unixtime(1, 4, new Date().getTime() / 1000, 1);
oWs.write_unixtime(1, 5, new Date().getTime() / 1000, 2);
oWs.write_vardate(1, 6, new Date().getVarDate(), 1); // met tijdzone
oWs.write_vardate(2, 6, new Date().getVarDate(), 0); // date only
oWs.write_vardate(3, 6, new Date().getVarDate(), 2); // time only
var jos = new Date('July 28, 1966')
//WScript.Echo(jos.getVarDate())
oWs.write_vardate(1, 7, jos.getVarDate(), 0);
oWs.write_unixtime(2, 7, jos.getTime() / 1000, 0);
var jos = new Date('July 28, 2024')
oWs.write_vardate(1, 8, jos.getVarDate(), 0);
oWs.write_unixtime(2, 8, jos.getTime() / 1000, 0);
var jos = new Date('July 28, 2121')
oWs.write_vardate(1, 9, jos.getVarDate(), 0);
oWs.write_unixtime(2, 9, jos.getTime() / 1000, 0);

var len = oWs.write_string(3, 0, "29-11-2023 16:24"); // 157 moeten we ombouwen naar 15?
//WScript.Echo("Lengte: " + len);
oWs.set_column_width(0, len / 10, 1);
var len = oWs.write_string(3, 1, "|||||||||||||||||||||||||||||||||||");
//WScript.Echo("Lengte: " + len);
oWs.set_column_width(1, len / 10, 1);
var len = oWs.write_string(3, 2, "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
//WScript.Echo("Lengte: " + len);
oWs.set_column_width(2, len / 10, 1);

oWs.write_string(65536, 0, "Deze cell moet ook beschrijfbaar zijn");


oWb.workbook_close();

WScript.Echo(filename + " has been created")