TextDocument extends Document implements ListContainer,
		ParagraphContainer, VariableContainer, ChartContainer, FormContainer,
		ControlContainer { public VariableField getVariableFieldByName(String name) { return getVariableContainerImpl().getVariableFieldByName(name); } protected  TextDocument(OdfPackage pkg, String internalPath, TextDocument.OdfMediaType odfMediaType); static TextDocument newTextDocument(); static TextDocument newTextDocument(TextDocument.OdfMediaType mimeType); static TextDocument newTextTemplateDocument(); static TextDocument newTextMasterDocument(); static TextDocument newTextWebDocument(); static TextDocument loadDocument(InputStream inputStream); static TextDocument loadDocument(String documentPath); static TextDocument loadDocument(File file); @Override OfficeTextElement getContentRoot(); OdfTextParagraph newParagraph(String text); OdfTextParagraph newParagraph(); OdfTextParagraph addText(String text); void changeMode(OdfMediaType mediaType); Section appendSection(Section section, boolean isResourceCopied); Section appendSection(String name); Header getHeader(); Header getHeader(boolean isFirstPage); Footer getFooter(); Footer getFooter(boolean isFirstPage); OdfElement getTableContainerElement(); OdfElement getListContainerElement(); List addList(); List addList(ListDecorator decorator); void clearList(); Iterator<List> getListIterator(); boolean removeList(List list); void addPageBreak(); void addPageBreak(Paragraph refParagraph); void setPageColumns(int columnsNumber, double spacing); void addColumnBreak(); void addColumnBreak(Paragraph refParagraph); void addPageBreak(Paragraph refParagraph, MasterPage master); Paragraph addParagraph(String text); boolean removeParagraph(Paragraph para); OdfElement getParagraphContainerElement(); Paragraph getParagraphByIndex(int index, boolean isEmptyParagraphSkipped); Paragraph getParagraphByReverseIndex(int reverseIndex, boolean isEmptyParagraphSkipped); Iterator<Paragraph> getParagraphIterator(); VariableField declareVariable(String name, VariableType type); VariableField getVariableFieldByName(String name); OdfElement getVariableContainerElement(); Chart createChart(String title, DataSet dataset, Rectangle rect); Chart createChart(String title, SpreadsheetDocument document, CellRangeAddressList cellRangeAddr, boolean firstRowAsLabel,
			boolean firstColumnAsLabel, boolean rowAsDataSeries, Rectangle rect); Chart createChart(String title, String[] labels, String[] legends, double[][] data, Rectangle rect); void deleteChartById(String chartId); void deleteChartByTitle(String title); Chart getChartById(String chartId); java.util.List<Chart> getChartByTitle(String title); int getChartCount(); TextTableOfContentElement createDefaultTOC(Paragraph refParagraph, boolean before); TextTableOfContentElement createTOCwithStyle(Paragraph refParagraph,
			TOCStyle additionalStyle, boolean before); Paragraph insertParagraph(Paragraph referenceParagraph, Paragraph sourceParagraph,boolean before); Table insertTable(Paragraph referenceParagraph, Table sourceTable,boolean before); OdfElement insertOdfElement(OdfElement referenceOdfElement,Document sourceDocument ,OdfElement sourceOdfElement,boolean before); void insertContentFromDocumentAfter(TextDocument sourceDocument, Paragraph referenceParagraph, boolean isCopyStyle); void insertContentFromDocumentBefore(TextDocument sourceDocument, Paragraph referenceParagraph, boolean isCopyStyle); Form createForm(String name); Iterator<Form> getFormIterator(); boolean removeForm(Form form); Form getFormByName(String name); OfficeFormsElement getFormContainerElement(); boolean getApplyDesignMode(); boolean getAutomaticFocus(); void setApplyDesignMode(boolean isDesignMode); void setAutomaticFocus(boolean isAutoFocus); Control createDrawControl(); OdfElement getDrawControlContainerElement();  }
@Test public void testGetVariableFieldByName() throws Exception { try { TextDocument tdoc = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("headerFooterHidden.odt")); Assert.assertNotNull(tdoc); VariableField vFieldA = tdoc.declareVariable("variable1", VariableField.VariableType.SIMPLE); vFieldA.getVariableName(); System.out.println(vFieldA.getVariableName()); Assert.assertEquals("variable1", vFieldA.getVariableName()); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage(), e); Assert.fail(e.getMessage()); } }