diff options
author | Yegor Kozlov <yegor@apache.org> | 2009-04-17 18:02:01 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2009-04-17 18:02:01 +0000 |
commit | 9eff4e10b36d171ed5a33771066b779604897aff (patch) | |
tree | 33621cb83b0e84d70138f56fbb3ee5b4cbebd138 /src/ooxml/testcases/org/apache/poi | |
parent | 2ab0a58566226570ecbf55b7700cfb31d1e60a74 (diff) | |
download | poi-9eff4e10b36d171ed5a33771066b779604897aff.tar.gz poi-9eff4e10b36d171ed5a33771066b779604897aff.zip |
Fixed XSSFCell to preserve cell style when cell value is set to blank, also avoid NPE in XSSFCell.setCellType() when workbook does not have SST, see bugs 47026 and 47028
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@766103 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi')
-rwxr-xr-x | src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java index b851d8827e..f97a6d1b81 100755 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCell.java @@ -17,7 +17,7 @@ package org.apache.poi.xssf.usermodel; -import org.apache.poi.ss.usermodel.BaseTestCell; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.XSSFITestDataProvider; /** @@ -28,4 +28,26 @@ public final class TestXSSFCell extends BaseTestCell { public TestXSSFCell() { super(XSSFITestDataProvider.getInstance()); } + + /** + * Bug 47026: trouble changing cell type when workbook doesn't contain + * Shared String Table + */ + public void test47026_1() throws Exception { + Workbook source = _testDataProvider.openSampleWorkbook("47026.xlsm"); + Sheet sheet = source.getSheetAt(0); + Row row = sheet.getRow(0); + Cell cell = row.getCell(0); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue("456"); + } + + public void test47026_2() throws Exception { + Workbook source = _testDataProvider.openSampleWorkbook("47026.xlsm"); + Sheet sheet = source.getSheetAt(0); + Row row = sheet.getRow(0); + Cell cell = row.getCell(0); + cell.setCellFormula(null); + cell.setCellValue("456"); + } }
\ No newline at end of file |