如何在ax2012中通过X ++读取后在​​Excel文件中更新?

时间:2016-12-14 07:39:43

标签: excel axapta dynamics-ax-2012 x++

我想在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);
}

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用WorkBook.saveAs方法?