poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dno...@apache.org
Subject svn commit: r1712769 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java
Date Thu, 05 Nov 2015 13:44:14 GMT
Author: dnorth
Date: Thu Nov  5 13:44:14 2015
New Revision: 1712769

URL: http://svn.apache.org/viewvc?rev=1712769&view=rev
Log:
Patch to bring CTTableStyleInfo into poi-ooxml-schemas by referencing it from a unit test.

Thanks to Danil Lopatin

https://bz.apache.org/bugzilla/show_bug.cgi?id=58579

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java?rev=1712769&r1=1712768&r2=1712769&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java Thu Nov
 5 13:44:14 2015
@@ -34,6 +34,7 @@ import org.apache.poi.xssf.streaming.SXS
 import org.junit.Test;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumn;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableStyleInfo;
 
 public final class TestXSSFTable {
 
@@ -72,4 +73,36 @@ public final class TestXSSFTable {
         assertTrue(outputFile.delete());
     }
 
+    @Test
+    public void testCTTableStyleInfo(){
+        XSSFWorkbook outputWorkbook = new XSSFWorkbook();
+        XSSFSheet sheet = outputWorkbook.createSheet();
+
+        //Create
+        XSSFTable outputTable = sheet.createTable();
+        outputTable.setDisplayName("Test");
+        CTTable outputCTTable = outputTable.getCTTable();
+
+        //Style configurations
+        CTTableStyleInfo outputStyleInfo = outputCTTable.addNewTableStyleInfo();
+        outputStyleInfo.setName("TableStyleLight1");
+        outputStyleInfo.setShowColumnStripes(false);
+        outputStyleInfo.setShowRowStripes(true);
+
+        XSSFWorkbook inputWorkbook = XSSFTestDataSamples.writeOutAndReadBack(outputWorkbook);
+        List<XSSFTable> tables = inputWorkbook.getSheetAt(0).getTables();
+        assertEquals("Tables number", 1, tables.size());
+
+        XSSFTable inputTable = tables.get(0);
+        assertEquals("Table display name", outputTable.getDisplayName(), inputTable.getDisplayName());
+
+        CTTableStyleInfo inputStyleInfo = inputTable.getCTTable().getTableStyleInfo();
+        assertEquals("Style name", outputStyleInfo.getName(), inputStyleInfo.getName());
+        assertEquals("Show column stripes",
+                outputStyleInfo.getShowColumnStripes(), inputStyleInfo.getShowColumnStripes());
+        assertEquals("Show row stripes",
+                outputStyleInfo.getShowRowStripes(), inputStyleInfo.getShowRowStripes());
+
+    }
+
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message