https://bz.apache.org/bugzilla/show_bug.cgi?id=60517

--- Comment #2 from Ricky <[email protected]> ---
It is incorrect in your interpretation. What I refer in my previous post is
multiple sheet reference, ie two sheet 1003 and 1856 of the same cells. What
you did is two different cells =SUM($'1003'.D28:$'1856'.D28)

I tried to type =SUM('1003':'1856'!D28)) in Microsoft Excel 2016 Mac, but it
pops up an error dialog.

I only read/parse Excel by POI no update/write in my test.

Here is part of incomplete code that is for demo purpose:

        private static HSSFWorkbook createHSSFWorkBook(String fileName) throws
IOException {
            FileInputStream fis = new FileInputStream(fileName);
            try {
                return new HSSFWorkbook(fis);
            } catch (Exception e) {
                logger.warn("Failed to parse Excel file: " + fileName, e);
                return null;
            } finally {
                fis.close();
            }
        }

        public static void generateJson(String sheetFilePath, String
jsonFilePath) throws IOException {

                // load external Excel file by POI
                Workbook wb = null;
                if (sheetFilePath.endsWith(".xlsx"))
                        wb = new XSSFWorkbook(sheetFilePath);
                else {
                        wb = XlParser.createHSSFWorkBook(sheetFilePath);
                        if (wb == null)
                                return;
                }

                // loop through each sheet
        for(int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets();
sheetIndex++) {
                Sheet sheet = wb.getSheetAt(sheetIndex);
                // loop through each row
                for (Row row : sheet) {
                        // loop through each cell
                    for (Cell cell : row) {
                        // retrieve cell reference
                        CellReference cellRef = new
CellReference(row.getRowNum(), cell.getColumnIndex());
                        switch(cell.getCellTypeEnum()) {
                                case FORMULA:
                                        String cellRefString =
cellRef.formatAsString();
                                        String formulaString = null;
                                        try {
                                                formulaString =
cell.getCellFormula();
                                        } catch (Exception e) {
                                                logger.fatal("Failed to get
formula in cell " + cellRefString);
                                                throw e;
                                        }

                                break;
                                case BOOLEAN:

                                        break;
                                case ERROR:

                                        break;
                                case NUMERIC:

                                        break;
                                case STRING:

                                        break;
                                default:
                                        break;
                        }
                    }// end of cell
                }// end of row
        }//end of sheet
 }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to