poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Dreher <jorge.dre...@gmail.com>
Subject The formulas I always return null - Excel 2003
Date Tue, 21 Jun 2016 19:14:25 GMT
Hi all, I find the following problem, a read cells containing simple
formulas (SUM (), NOW (), AVERAGE ()) of a spreadsheet excel 2003 I always
returns null, attached the block of code that I use for testing and
attached the form that I am reading.

Walking through the rows cellIterator, I notice that I only returns those
cells that contain formulas.
The highlighted cells are those that always returns null me.

Code:

Iterator<Row> rowIterator = sheet.iterator();
        while (rowIterator.hasNext())
        {

            //Get the row object
            Row row = rowIterator.next();

            //Every row has columns, get the column iterator and iterate
over them

            int columnas = row.getPhysicalNumberOfCells();
            System.out.println("La fila=" + row.getRowNum() + " tiene " +
columnas + " columnas.");

            Iterator<Cell> cellIterator = row.cellIterator();

            while (cellIterator.hasNext())
            {
                //Get the Cell object

                Cell cell = cellIterator.next();
                System.out.println("cell col:fila = " +
cell.getColumnIndex() + ":" + cell.getRowIndex() + " string value=" +
 cell.toString() + " tipo=" + cell.getCellType());


                if(cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
        System.out.println("Formula is " + cell.getCellFormula());
        switch(cell.getCachedFormulaResultType()) {
        case Cell.CELL_TYPE_NUMERIC:
        System.out.println("Last evaluated as: " +
cell.getNumericCellValue());
        break;
        case Cell.CELL_TYPE_STRING:
        System.out.println("Last evaluated as \"" +
cell.getRichStringCellValue() + "\"");
        break;
        }
        }

            }

        }


Poi-use version 3.15-beta1.

Thank!

-- 
Atte. Jorge A. Dreher
Consultor IT

jorge.dreher@gmail.com
skype: jorge.dreher
Movil: +54 011 1564493602

Por favor, antes de imprimir este mensaje, asegúrate de que es necesario.
Ayudemos a cuidar el medio ambiente.

Confidencial. Para uso exclusivamente interno.
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario
indicado, queda notificado de que la lectura, utilización, divulgación y/o
copia sin autorización está prohibida en virtud de la legislación
vigente.Si ha recibido este mensaje por error, le rogamos que nos lo
comunique inmediatamente por esta misma vía y proceda a su destrucción.El
correo electrónico vía Internet no permite asegurar la confidencialidad de
los mensajes que se transmiten ni su integridad o correcta recepción.


This message is intended exclusively for its addressee and may contain
information that is CONFIDENTIAL and protected by a professional privilege
or whose disclosure is prohibited by law. If you are not the intended
recipient you are hereby notified that any read, dissemination, copy or
disclosure of this communication is strictly prohibited by law. If this
message has been received in error, please immediately notify us via e-mail
and delete it.Internet e-mail neither guarantees the confidentiality nor
the integrity or proper receipt of the messages sent.

Mime
View raw message