Package org.odftoolkit.odfdom.dom.element.style

Examples of org.odftoolkit.odfdom.dom.element.style.StyleHeaderElement


  public Header getHeader(boolean isFirstPage) {
    Header tmpHeader = isFirstPage ? firstPageHeader : standardHeader;
    if (tmpHeader == null) {
      try {
        StyleMasterPageElement masterPageElement = getMasterPage(isFirstPage);
        StyleHeaderElement headerElement = OdfElement.findFirstChildNode(StyleHeaderElement.class,
            masterPageElement);
        if (headerElement == null) {
          headerElement = masterPageElement.newStyleHeaderElement();
        }
        tmpHeader = new Header(headerElement);
View Full Code Here


  @Test
  public void testGetOdfElement() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      Header header = doc.getHeader();
      StyleHeaderElement styleheader = header.getOdfElement();
      Assert.assertNotNull(styleheader);
      Assert.assertEquals("header", styleheader.getLocalName());

      //save
      doc.save(ResourceUtilities.newTestOutputFile("headerHiddenOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(HeaderTest.class.getName()).log(Level.SEVERE, null, e);
View Full Code Here

      Header header = doc.getHeader();
     
      header.declareVariable("headername", VariableType.USER);
     
      //validate
      StyleHeaderElement styleHeader = header.getOdfElement();
      Node nod = styleHeader.getFirstChild().getFirstChild();
      NamedNodeMap nameMap = nod.getAttributes();
      Node nodtext = nameMap.getNamedItem("text:name");
      Assert.assertEquals("headername", nodtext.getNodeValue());

      //save
View Full Code Here

      header.declareVariable("headername", VariableType.USER);
      VariableField vField = header.getVariableFieldByName("headername");
      String vName = vField.getVariableName();
     
      //validate
      StyleHeaderElement styleHead = header.getOdfElement();
      Node nod = styleHead.getFirstChild().getFirstChild();
      NamedNodeMap nameMap = nod.getAttributes();
      Node nodtext = nameMap.getNamedItem("text:name");
      Assert.assertEquals(vName, nodtext.getNodeValue());

      //save
View Full Code Here

  @Test
  public void testGetOdfElement() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      Header header = doc.getHeader();
      StyleHeaderElement styleheader = header.getOdfElement();
      Assert.assertNotNull(styleheader);
      Assert.assertEquals("header", styleheader.getLocalName());

      //save
      doc.save(ResourceUtilities.newTestOutputFile("headerHiddenOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(HeaderTest.class.getName()).log(Level.SEVERE, null, e);
View Full Code Here

      Header header = doc.getHeader();
     
      header.declareVariable("headername", VariableType.USER);
     
      //validate
      StyleHeaderElement styleHeader = header.getOdfElement();
      Node nod = styleHeader.getFirstChild().getFirstChild();
      NamedNodeMap nameMap = nod.getAttributes();
      Node nodtext = nameMap.getNamedItem("text:name");
      Assert.assertEquals("headername", nodtext.getNodeValue());

      //save
View Full Code Here

      header.declareVariable("headername", VariableType.USER);
      VariableField vField = header.getVariableFieldByName("headername");
      String vName = vField.getVariableName();
     
      //validate
      StyleHeaderElement styleHead = header.getOdfElement();
      Node nod = styleHead.getFirstChild().getFirstChild();
      NamedNodeMap nameMap = nod.getAttributes();
      Node nodtext = nameMap.getNamedItem("text:name");
      Assert.assertEquals(vName, nodtext.getNodeValue());

      //save
View Full Code Here

      TextDocument doc = TextDocument.newTextDocument();
      Header header = doc.getHeader();
      Section sect = header.appendSection("Section1");
      Assert.assertNotNull(sect);

      StyleHeaderElement styleHead = header.getOdfElement();
      Node nod = styleHead.getFirstChild();
      NamedNodeMap nameMap = nod.getAttributes();
      Node nodtext = nameMap.getNamedItem("text:name");
      Assert.assertEquals("Section1", nodtext.getNodeValue());

    } catch (Exception e) {
View Full Code Here

      odfDoc = OdfDocument.loadDocument(ResourceUtilities.getAbsolutePath("TestHeaderFooter.odt"));
      Map<String, StyleMasterPageElement> masterPages2 = odfDoc.getMasterPages();
      StyleMasterPageElement masterPage2 = masterPages2.get("Standard");

        // Test if the new footer exists
      StyleHeaderElement headerContentRoot2 = OdfElement.findFirstChildNode(StyleHeaderElement.class, masterPage2);
      Assert.assertNotNull(headerContentRoot2);
      StyleFooterElement footerContentRoot2 = OdfElement.findFirstChildNode(StyleFooterElement.class, masterPage2);
      Assert.assertNotNull(footerContentRoot2);
     
    } catch (Exception ex) {
View Full Code Here

  public Header getHeader(boolean isFirstPage) {
    Header tmpHeader = isFirstPage ? firstPageHeader : standardHeader;
    if (tmpHeader == null) {
      try {
        StyleMasterPageElement masterPageElement = getMasterPage(isFirstPage);
        StyleHeaderElement headerElement = OdfElement.findFirstChildNode(StyleHeaderElement.class,
            masterPageElement);
        if (headerElement == null) {
          headerElement = masterPageElement.newStyleHeaderElement();
        }
        tmpHeader = new Header(headerElement);
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.style.StyleHeaderElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.