|
|
|
|
|
The following code is used to browse all the cells found in the different worksheets of an XLS file. // File name sNameExcelFile is string // The file to open is selected by the user sNameExcelFile = fSelect("", sNameExcelFile, "Specify the Excel file to read", ... "Excel workbook (*.XLS)" + TAB + "*.XLS" + CR + "All files (*.*)" + TAB + "*.*", ... "*.XLS", fselOpen + fselExist) // Cancelation? IF sNameExcelFile = "" THEN RETURN // Opens the file xlsdoc is xlsDocument xlsdoc = xlsOpen(sNameExcelFile) IF ErrorOccurred THEN Error("Failure opening the Excel workbook", ErrorInfo()) RETURN END nWorksheetNum is int nNbWorksheetRows is int nNbWorksheetColumns is int nRowNum is int nColumnNum is int // For each worksheet of the workbook FOR nWorksheetNum = 1 _TO_ xlsdoc.NumberWorksheet // Position on the specified worksheet xlsdoc.Worksheet = nWorksheetNum // Number of rows nNbWorksheetRows = xlsdoc.NumberRow nNbWorksheetColumns = xlsdoc.NumberColumn // Progress bar PROGBAR_ProgBar = 0 PROGBAR_ProgBar.MaxValue = nNbWorksheetRows FOR nRowNum = 1 _TO_ nNbWorksheetRows PROGBAR_ProgBar++ FOR nColumnNum = 1 _TO_ nNbWorksheetColumns Trace("Row " + nRowNum + ", Column " + nColumnNum + "=" + .. xlsdoc.Cell[nRowNum, nColumnNum]) END END END Info("Reading completed")
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|