aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2021-01-03 12:01:08 +0000
committerDominik Stadler <centic@apache.org>2021-01-03 12:01:08 +0000
commit218354f5b99de0e0a69dbba6def792745d83db31 (patch)
tree02a2a1c7492216959f7218f55f18dec36a753893 /src/ooxml/testcases
parente59e84a2139470b0f60c54b6dbdea6eafca03fb0 (diff)
downloadpoi-218354f5b99de0e0a69dbba6def792745d83db31.tar.gz
poi-218354f5b99de0e0a69dbba6def792745d83db31.zip
Bug 64494: Ensure "applyAlignment" in cell-styles is enabled when necessary
Also check it when fetching currently defined cell-alignment git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885059 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases')
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
index 7f17019844..034cdf1613 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
@@ -3630,7 +3630,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
@Test
- public void test64986() throws IOException {
+ public void test64986() {
XSSFWorkbook w = new XSSFWorkbook();
XSSFSheet s = w.createSheet();
XSSFRow r = s.createRow(0);
@@ -3667,4 +3667,37 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertNotNull(wb);
}
}
+
+ @Test
+ public void test64494() throws IOException {
+ try (Workbook wb = new XSSFWorkbook()) {
+ CellStyle styleRight = wb.createCellStyle();
+ CellStyle styleLeft = wb.createCellStyle();
+ styleRight.setAlignment(HorizontalAlignment.RIGHT);
+ //styleRight.setBorderBottom(BorderStyle.DASH_DOT);
+ styleLeft.setAlignment(HorizontalAlignment.LEFT);
+ //styleLeft.setBorderRight(BorderStyle.MEDIUM);
+
+ assertEquals(HorizontalAlignment.RIGHT, styleRight.getAlignment());
+ assertEquals(HorizontalAlignment.LEFT, styleLeft.getAlignment());
+
+ Sheet sheet = wb.createSheet("test");
+ Row row = sheet.createRow(0);
+
+ Cell cellRight = row.createCell(0);
+ cellRight.setCellValue("R");
+ cellRight.setCellStyle(styleRight);
+
+ Cell cellLeft = row.createCell(1);
+ cellLeft.setCellValue("L");
+ cellLeft.setCellStyle(styleLeft);
+
+ /*try (OutputStream out = new FileOutputStream("/tmp/64494.xlsx")) {
+ wb.write(out);
+ }*/
+
+ assertEquals(HorizontalAlignment.RIGHT, cellRight.getCellStyle().getAlignment());
+ assertEquals(HorizontalAlignment.LEFT, cellLeft.getCellStyle().getAlignment());
+ }
+ }
}