Print To Excel

Return To AX Content

//Printing to an excel file
sysExcelApplication excel = sysExcelApplication::construct();
sysExcelWorkSheet worksheet;
container worksheetRow;
common currentRecord;
int columns, rows;

worksheet = excel.workbooks().item(1).worksheets().itemFromNum(1);

// Getting the data using a query. currentRecord gets the data.
// Filling the worksheetRow using another method, depending on fieldtype, etc.
for (columns = 1 ; columns <= conlen(worksheetRow);columns++)

worksheetRow = connull();;

SysExcelApplication::construct() contains this piece of code:

excel = COM::getObject(#EXCEL);
if (! excel)
excel = new COM(#EXCEL);

Return To AX Content