static void CreateExcelMallik(Args _args)
{
SysExcelApplication xlsApplication;
SysExcelWorkBooks xlsWorkBookCollection;
SysExcelWorkBook xlsWorkBook;
SysExcelWorkSheets xlsWorkSheetCollection;
SysExcelWorkSheet xlsWorkSheet;
SysExcelRange xlsRange;
AsciiIO tmpfile;
Filename tmpfilename;
FileIOPermission permission;
TreeNode treeNode;
TreeNode treeNodeTables;
#File
#AOT
int row = 1;
str fileName;
;
treeNodeTables = TreeNode::findNode(#SecurityKeysPath);
// Name of the Excel document.
fileName = "C:\\test.xsl";
// Excel open and initialize.
xlsApplication = SysExcelApplication::construct();
xlsApplication.visible(true); //Generate new Excel worksheet.
xlsWorkBookCollection = xlsApplication.workbooks();
xlsWorkBook = xlsWorkBookCollection.add();
xlsWorkSheetCollection = xlsWorkBook.worksheets();
xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);
// Write headlines cells in the worksheet.
xlsWorkSheet.cells().item(row,1).value('Name'); xlsWorkSheet.cells().item(row,2).value('ID');
row++;
// first table
treeNode = treeNodeTables.AOTfirstChild();
// Excel worksheet with fill data (Excel fill-cells).
while (treeNode != null)
{
xlsWorkSheet.cells().item(row,1).value(treeNode.AOTname()); xlsWorkSheet.cells().item(row,2).value(treeNode.applObjectId());
row++; // next table
treeNode = treeNode.AOTnextSibling();
}
// Check whether the document already exists.
if(WinApi::fileExists(fileName))
{
WinApi::deleteFile(fileName);
}
// Excel document store.
xlsWorkbook.saveAs(fileName);
//Close Excel.
xlsApplication.quit(); xlsApplication.finalize();
}
{
SysExcelApplication xlsApplication;
SysExcelWorkBooks xlsWorkBookCollection;
SysExcelWorkBook xlsWorkBook;
SysExcelWorkSheets xlsWorkSheetCollection;
SysExcelWorkSheet xlsWorkSheet;
SysExcelRange xlsRange;
AsciiIO tmpfile;
Filename tmpfilename;
FileIOPermission permission;
TreeNode treeNode;
TreeNode treeNodeTables;
#File
#AOT
int row = 1;
str fileName;
;
treeNodeTables = TreeNode::findNode(#SecurityKeysPath);
// Name of the Excel document.
fileName = "C:\\test.xsl";
// Excel open and initialize.
xlsApplication = SysExcelApplication::construct();
xlsApplication.visible(true); //Generate new Excel worksheet.
xlsWorkBookCollection = xlsApplication.workbooks();
xlsWorkBook = xlsWorkBookCollection.add();
xlsWorkSheetCollection = xlsWorkBook.worksheets();
xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);
// Write headlines cells in the worksheet.
xlsWorkSheet.cells().item(row,1).value('Name'); xlsWorkSheet.cells().item(row,2).value('ID');
row++;
// first table
treeNode = treeNodeTables.AOTfirstChild();
// Excel worksheet with fill data (Excel fill-cells).
while (treeNode != null)
{
xlsWorkSheet.cells().item(row,1).value(treeNode.AOTname()); xlsWorkSheet.cells().item(row,2).value(treeNode.applObjectId());
row++; // next table
treeNode = treeNode.AOTnextSibling();
}
// Check whether the document already exists.
if(WinApi::fileExists(fileName))
{
WinApi::deleteFile(fileName);
}
// Excel document store.
xlsWorkbook.saveAs(fileName);
//Close Excel.
xlsApplication.quit(); xlsApplication.finalize();
}
No comments:
Post a Comment