Use the following job :)
static void createExcel(Args _args)
{
SysExcelApplication excel;
SysExcelWorkBooks books;
SysExcelWorkBook book;
Filename excelFileName;
boolean createShowDialog()
{
Dialog dialog = new Dialog('Create excel');
DialogGroup dlgGrpExcelPath;
DialogField dialogExcelPath;
container filterCriteria;
;
dlgGrpExcelPath = dialog.addGroup('Excel file name',dlgGrpExcelPath);
dialogExcelPath = dialog.addField(typeid(FileNameSave),'File name');
filterCriteria = ['*.xls','*.xls'];
filterCriteria = dialog.filenameLookupFilter(filterCriteria);
if (dialog.run())
{
excelFileName = dialogExcelPath.value();
return true;
}
return false;
}
;
if (!createShowDialog())
{
return;
}
excel = SysExcelApplication::construct();
excel.displayAlerts(false);
books = excel.workbooks();
if (excel.workbooks().count())
{
excel.workbooks().close();
}
book = books.add();
book.saveAs(excelFileName);
excel.quit();
}
{
SysExcelApplication excel;
SysExcelWorkBooks books;
SysExcelWorkBook book;
Filename excelFileName;
boolean createShowDialog()
{
Dialog dialog = new Dialog('Create excel');
DialogGroup dlgGrpExcelPath;
DialogField dialogExcelPath;
container filterCriteria;
;
dlgGrpExcelPath = dialog.addGroup('Excel file name',dlgGrpExcelPath);
dialogExcelPath = dialog.addField(typeid(FileNameSave),'File name');
filterCriteria = ['*.xls','*.xls'];
filterCriteria = dialog.filenameLookupFilter(filterCriteria);
if (dialog.run())
{
excelFileName = dialogExcelPath.value();
return true;
}
return false;
}
;
if (!createShowDialog())
{
return;
}
excel = SysExcelApplication::construct();
excel.displayAlerts(false);
books = excel.workbooks();
if (excel.workbooks().count())
{
excel.workbooks().close();
}
book = books.add();
book.saveAs(excelFileName);
excel.quit();
}
Happy Daxing !
Aucun commentaire:
Enregistrer un commentaire