Hi all... I want to read data from excel worksheet.Below is the code written in axapta but it does not work.I can read strings from excel cells but can not read integer or real values correctly. The integer in the cell is 123456789 but the value read from excel cell is 123.I can not find and fix the error. Can anybody tell me where the mistake is.
Regards static void Job3(Args _args) { ExcelImport EIS; COMVariant COMVariant1; SysExcelApplication app; SysExcelWorkbooks Workbooks; SysExcelWorkbook Workbook; SysExcelWorksheets Worksheets; SysExcelWorksheet Worksheet; SysExcelCells Cells; SysExcelCell_XP RCell; int i; //#excel app = SysExcelApplication::construct(); Workbooks = app.Workbooks(); COMVariant1 = new COMVariant(); COMVariant1.bStr("C:\\Book1.xls"); Workbook = Workbooks.Add(COMVariant1); Worksheets = Workbook.worksheets(); Worksheet = Worksheets.itemFromName("EIS"); Worksheet.protect ("123123",true,true,true,true,true,true,true,true); Cells = Worksheet.Cells(); i = 2; RCell = Cells.Item(i, 1); ttsbegin; while(RCell.Value().bstr() != ' ') { // EIS.No = str2int(RCell.value().toString()); info(int2str(str2int(RCell.value().toString()))); RCell = Cells.Item(i, 2); // EIS.Name = RCell.value().bStr(); info(RCell.value().bStr()); RCell = Cells.Item(i, 3); // EIS.RealNum =str2num(RCell.value().toString()); info(int2str(str2int(RCell.value().toString()))); // EIS.insert(); i++; RCell = Cells.Item(i, 1); } ttscommit; Worksheet.protect("123123"); Workbooks.close(); }