Header extends Component implements TableContainer, VariableContainer { public Table addTable() { Table table = getTableContainerImpl().addTable(); updateTableToNone(table); return table; } Header(StyleHeaderElement element); StyleHeaderElement getOdfElement(); boolean isVisible(); void setVisible(boolean isVisible); Table addTable(); Table addTable(int numRows, int numCols); Table getTableByName(String name); java.util.List<Table> getTableList(); TableBuilder getTableBuilder(); OdfElement getTableContainerElement(); OdfElement getVariableContainerElement(); VariableField declareVariable(String name, VariableType type); VariableField getVariableFieldByName(String name); Section appendSection(String name);  }
@Test public void testAddTable() { try { TextDocument doc = TextDocument.newTextDocument(); Header header = doc.getHeader(); Assert.assertNotNull(header); Table table = header.addTable(); table.setTableName("headerTable"); int rowCount = table.getRowCount(); int columnCount = table.getColumnCount(); String expectedCellValue = "header table cell"; table.getCellByPosition(1, 1).setStringValue(expectedCellValue); Cell cell = table.getCellByPosition(4, 0); cell.setImage(ResourceUtilities.getURI("image_list_item.png")); header = doc.getHeader(true); Assert.assertNotNull(header); table = header.addTable(); table.setTableName("headerHTable"); doc.save(ResourceUtilities.newTestOutputFile(headerDocumentPath)); doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(headerDocumentPath)); header = doc.getHeader(); table = header.getTableByName("headerTable"); Assert.assertEquals(rowCount, table.getRowCount()); Assert.assertEquals(columnCount, table.getColumnCount()); Assert.assertEquals(expectedCellValue, table.getCellByPosition(1, 1).getStringValue()); cell = table.getCellByPosition(4, 0); Assert.assertEquals(34, cell.getBufferedImage().getHeight(null)); table.getColumnByIndex(4).setWidth(15); header = doc.getHeader(true); table = header.getTableByName("headerHTable"); Assert.assertNotNull(table); } catch (Exception e) { Logger.getLogger(HeaderTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(e.getMessage()); } }