poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vedgunjan" <vedgunjan.si...@yagnaiq.com>
Subject How to read the Content of the cell whose type is : CELL_TYPE_FORMULA
Date Sun, 07 Oct 2007 09:01:55 GMT
 

Hi Experts,

 

This is my requirements:

 

Am creating Excel Workbook through Java code and storing the workbook in DB
as a BLOB.

I then have to read that Excel file and Put the data back in to PDF
document.

 

For this am reading the Excel sheet and converting the excel data into
in-memory xml stream.

The Problem is, the cell which are of type HSSFCell.CELL_TYPE_FORMULA, on
reading the value of the cell,using cell.getCellFormula(), am getting the
formula as string, but actually I want the value which is present in that
cell.

 

For example: lets say a cell has formula as =+G5*F5, and its value as 200.

Below is the code for reading the cell contents.

 

if (totalPriceCell != null)

        {

            int cellType = totalPriceCell.getCellType();

        

            if (cellType == HSSFCell.CELL_TYPE_FORMULA)

            {

                cellValue =
String.valueOf(totalPriceCell.getNumericCellValue());//this return 0.0

                cellValue = totalPriceCell. getCellFormula();//this return
=+G5*F5

            }

}

 

This is my Problem:

 

How will the get the content of that cell i.e 200.

 

 

Hope am able to explain my problem.

 

Can some one guide me as how I will be able to get the content of the cell
of type FORMULA.

 

 

Thanks & Regards

Ved Gunjan.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message