Exporting Table field data to excel
Ive used EmplTable and have exported EmplId & Name. You can extend this :)
static void ArijitExcel(Args _args)
{
EmplTable EmplTableLocal;
SysExcelApplication excelApp;
SysExcelWorkSheet excelWorksheet;
SysExcelRange excelRange;
SysExcelCells excelCells;
SysExcelCell excelCell;
ComVariant cellValue;
Int i=1;
;
excelApp = SysExcelApplication::construct();
cellValue = new ComVariant() ;
excelApp.workbooks().add();
excelWorksheet = excelApp.worksheets().itemFromNum( 1 );
excelCells = excelWorksheet.cells();
while select * from EmplTableLocal
{
excelCells.item(i+4,4).value(cellValue.bStr(EmplTableLocal.EmplId));
excelCells.item(i+4,5).value(cellValue.bStr(EmplTableLocal.Name));
i++;
}
excelApp.visible(true);
//excelApp.quit();
}
1 comment:
Thank arijit. wow another superb code for us to used. I have one question thought. how about reading the excel file content and writing back the data to ax table, do you have sample code?
thanks,
Patrick chua
AX developer from the Philippines
Post a Comment