Lines 34-39
Link Here
|
34 |
import org.junit.Test; |
34 |
import org.junit.Test; |
35 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable; |
35 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable; |
36 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumn; |
36 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumn; |
|
|
37 |
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableStyleInfo; |
37 |
|
38 |
|
38 |
public final class TestXSSFTable { |
39 |
public final class TestXSSFTable { |
39 |
|
40 |
|
Lines 72-75
Link Here
|
72 |
assertTrue(outputFile.delete()); |
73 |
assertTrue(outputFile.delete()); |
73 |
} |
74 |
} |
74 |
|
75 |
|
|
|
76 |
@Test |
77 |
public void testCTTableStyleInfo(){ |
78 |
XSSFWorkbook outputWorkbook = new XSSFWorkbook(); |
79 |
XSSFSheet sheet = outputWorkbook.createSheet(); |
80 |
|
81 |
//Create |
82 |
XSSFTable outputTable = sheet.createTable(); |
83 |
outputTable.setDisplayName("Test"); |
84 |
CTTable outputCTTable = outputTable.getCTTable(); |
85 |
|
86 |
//Style configurations |
87 |
CTTableStyleInfo outputStyleInfo = outputCTTable.addNewTableStyleInfo(); |
88 |
outputStyleInfo.setName("TableStyleLight1"); |
89 |
outputStyleInfo.setShowColumnStripes(false); |
90 |
outputStyleInfo.setShowRowStripes(true); |
91 |
|
92 |
XSSFWorkbook inputWorkbook = XSSFTestDataSamples.writeOutAndReadBack(outputWorkbook); |
93 |
List<XSSFTable> tables = inputWorkbook.getSheetAt(0).getTables(); |
94 |
assertEquals("Tables number", 1, tables.size()); |
95 |
|
96 |
XSSFTable inputTable = tables.get(0); |
97 |
assertEquals("Table display name", outputTable.getDisplayName(), inputTable.getDisplayName()); |
98 |
|
99 |
CTTableStyleInfo inputStyleInfo = inputTable.getCTTable().getTableStyleInfo(); |
100 |
assertEquals("Style name", outputStyleInfo.getName(), inputStyleInfo.getName()); |
101 |
assertEquals("Show column stripes", |
102 |
outputStyleInfo.getShowColumnStripes(), inputStyleInfo.getShowColumnStripes()); |
103 |
assertEquals("Show row stripes", |
104 |
outputStyleInfo.getShowRowStripes(), inputStyleInfo.getShowRowStripes()); |
105 |
|
106 |
} |
107 |
|
75 |
} |
108 |
} |