ASF Bugzilla – Attachment 15050 Details for
Bug 21923
[PATCH] Modify HSSFWorkbook, FormulaParser and SheetReferences to support 3DRefs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test class that exhibits the problem
TestClass.java (text/plain), 1.90 KB, created by
Eric Ladner
on 2005-05-16 17:47:32 UTC
(
hide
)
Description:
Test class that exhibits the problem
Filename:
MIME Type:
Creator:
Eric Ladner
Created:
2005-05-16 17:47:32 UTC
Size:
1.90 KB
patch
obsolete
>import org.apache.poi.poifs.filesystem.POIFSFileSystem; >import org.apache.poi.hssf.usermodel.HSSFWorkbook; >import org.apache.poi.hssf.usermodel.HSSFSheet; >import org.apache.poi.hssf.usermodel.HSSFRow; >import org.apache.poi.hssf.usermodel.HSSFCell; >import org.apache.poi.hssf.record.formula.*; >import org.apache.poi.hssf.model.*; > >import java.io.FileInputStream; >import java.io.IOException; > >public class TestClass >{ > private POIFSFileSystem fs = null; > private HSSFWorkbook wb = null; > private HSSFSheet sheet = null; > private int numSheets; > //private HSSFSheet sheets[]; > > TestClass(String spreadsheet) throws IOException { > > fs = new POIFSFileSystem(new FileInputStream(spreadsheet)); > wb = new HSSFWorkbook(fs); > } > > private String getCellValue(HSSFCell c) { > String val = null; > if (c != null) { > int cellType = c.getCellType(); > switch (cellType) { > case HSSFCell.CELL_TYPE_STRING: > val = c.getStringCellValue(); > break; > case HSSFCell.CELL_TYPE_FORMULA: > //System.out.println(c.getCellFormula()); > val = doFormula(c.getCellFormula()); > break; > } > } > return val; > } > > private String doFormula(String formula) { > FormulaParser fp = new FormulaParser(formula, null); > fp.parse(); > > Ptg[] ptgs = fp.getRPNPtg(); > if (ptgs == null || ptgs.length == 0) { > return "<NULL>"; > } > > return fp.toFormulaString(null, ptgs); > } > > public void process() { > sheet = wb.getSheetAt(2); > HSSFRow row = sheet.getRow(0); > > System.out.println(getCellValue(row.getCell((short)0))); > } > > public static void main(String[] args) throws IOException { > TestClass tc = new TestClass("test.xls"); > tc.process(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 21923
:
7539
| 15050 |
15051