-1

I want to update the Excel file after reading it through X++ in ax 2012. I know how to write but I want to write after reading from Excel sheet? Below is the code of writing:

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);
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

Have you tried using the WorkBook.saveAs method?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • B yes my requirement is after reading the content, i want to add a new column and write the acknowledged msg against each row – user1371416 Dec 15 '16 at 07:45