Header extends Component implements TableContainer, VariableContainer { public VariableField getVariableFieldByName(String name) { return getVariableContainerImpl().getVariableFieldByName(name); } 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 testGetVariableFieldByName() { try { TextDocument doc = TextDocument.newTextDocument(); Header header = doc.getHeader(); header.declareVariable("headername", VariableType.USER); VariableField vField = header.getVariableFieldByName("headername"); String vName = vField.getVariableName(); StyleHeaderElement styleHead = header.getOdfElement(); Node nod = styleHead.getFirstChild().getFirstChild(); NamedNodeMap nameMap = nod.getAttributes(); Node nodtext = nameMap.getNamedItem("text:name"); Assert.assertEquals(vName, nodtext.getNodeValue()); doc.save(ResourceUtilities.newTestOutputFile("headerTableOutput.odt")); } catch (Exception e) { Logger.getLogger(HeaderTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(e.getMessage()); } }