AX2012 从Excel中导入数据
static void TestImportResult(Args _args) { SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; int rowIdx = 2; str resultfileName; str startTimeStr, endTimeStr; utcDateTime startTime, endTime; ; resultfileName = strFmt(@"xxxxx\result1.xlsx");
application = SysExcelApplication::construct(); workbooks = application.workbooks(); workbooks.open(resultfileName); workbook = workbooks.item(1); worksheets = workbook.worksheets(); worksheet = worksheets.itemFromNum(1); //Here 1 is the worksheet Number cells = worksheet.cells(); while (cells.item(rowIdx, 1).value().bStr() != "") { startTimeStr = cells.item(rowIdx, 17).value().bStr(); endTimeStr = cells.item(rowIdx, 18).value().bStr(); startTime = str2datetime(startTimeStr, 321); endTime = str2datetime(endTimeStr, 321); info(strFmt("%1 %2", startTime, endTime)); rowIdx++; } }