我想在ax 2012中通过X ++阅读后更新Excel文件。我知道如何写,但我想在阅读Excel表格后写一下?以下是编写的代码:
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);
cell.value(custTable.AccountNum);
cell = cells.item(row, 2);
cell.value(custTable.name());
}
excel.visible(true);
}