27.10.2015, 16:29 | #1 |
Участник
|
Чтение Excel как string
Доброго времени суток!
X++: public void Import() { SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; COMVariantType type; int row = 0; if(!this.dialogPrompt()) return; application = SysExcelApplication::construct(); workbooks = application.workbooks(); try { workbooks.open(filename); } catch (Exception::Error) { throw error("File cannot be opened."); } workbook = workbooks.item(1); worksheets = workbook.worksheets(); worksheet = worksheets.itemFromNum(1); cells = worksheet.cells(); do { row++; info(strfmt('%1 - %2', cells.item(row, 1).value().bStr(), cells.item(row, 2).value().bStr())); type = cells.item(row+1, 1).value().variantType(); } while (type != COMVariantType::VT_EMPTY); application.quit(); } |
|