diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-11-24 09:55:33 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-11-24 09:55:33 +0000 |
commit | 7b02f24e4767ac64c2ee83fc3063c0230804f8b0 (patch) | |
tree | 4f4e1a79367f69b4cf2d2338a77d0745621b6b0f /poi-ooxml | |
parent | aa92a67baf72d6a3c3cbc9c8b657d2e0ae5c34d6 (diff) | |
download | poi-7b02f24e4767ac64c2ee83fc3063c0230804f8b0.tar.gz poi-7b02f24e4767ac64c2ee83fc3063c0230804f8b0.zip |
[github-281] Thanks to This closes #281
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895284 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java b/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java index 101fa6c10e..18254af451 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java +++ b/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java @@ -29,6 +29,7 @@ import java.util.regex.Pattern; import javax.swing.JLabel; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.format.CellFormat; import org.apache.poi.ss.format.CellFormatPart; @@ -217,4 +218,22 @@ class TestCellFormatPart { } } } + + @Test + void testDecimalFormat() throws Exception { + // Create a workbook, row and cell to test with + try (Workbook wb = new HSSFWorkbook()) { + Sheet sheet = wb.createSheet(); + Row row = sheet.createRow(0); + Cell cell = row.createCell(0); + + CellFormat cf = CellFormat.getInstance("[<=.01]0.00%;#,##0"); + + cell.setCellValue(1); + assertEquals("1", cf.apply(cell).text); + + cell.setCellValue(.001); + assertEquals("0.10%", cf.apply(cell).text); + } + } } |