Hi Qiwei,
I am assuming that you are trying to export data in a table to a export file.
I considered custTable Table data. In that, I am exporting the data of AccountNum and Name.
Here is the code and doing it through a job. Please use the code as per your requirements.
static void CreateExcelFile(Args _args)
{
CustTable custTable;
SysExcelApplication excel;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;
excel = SysExcelApplication::construct();
workbooks = excel.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range(‘A:A’).numberFormat(’@’);
while select custTable
{
row++;
cell = cells.item(row+1, 2);
cell.value(custTable.AccountNum);
cell = cells.item(row+1, 3);
cell.value(custTable.name());
}
excel.visible(true);
}