Examples of OfficeTextElement


Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

      OdfDrawFrame frame1 = (OdfDrawFrame) image.getParentNode();
      frame1.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PAGE.toString());
      frame1.setTextAnchorPageNumberAttribute(1);

      //add paragraph
      OfficeTextElement office = doc.getContentRoot();
      OdfTextParagraph para1 = (OdfTextParagraph) office.newTextPElement();
      para1.setTextContent("insert an image here");
      String imagePath2 = doc.newImage(mImageUri_ODFDOM);

      OdfTextParagraph para2 = (OdfTextParagraph) office.newTextPElement();
      para2.setTextContent("another");
      String imagePath3 = doc.newImage(mImageUri_ODFDOM);
      OdfDrawImage image3 = getImageByPath(doc, imagePath3).get(1);
      OdfDrawFrame frame3 = (OdfDrawFrame) image3.getParentNode();
      frame3.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.CHAR.toString());
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

   *
   * @return The new paragraph
   * @throws Exception if the file DOM could not be created.
   */
  public OdfTextParagraph newParagraph() throws Exception {
    OfficeTextElement odfText = getContentRoot();
    return (OdfTextParagraph) odfText.newTextPElement();
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

   * @param text initial text for the paragraph.
   * @return The paragraph at the end of the text document, where the text has been added to.
   * @throws Exception if the file DOM could not be created.
   */
  public OdfTextParagraph addText(String text) throws Exception {
    OfficeTextElement odfText = getContentRoot();
    Node n = odfText.getLastChild();
    OdfTextParagraph para;
    if (OdfTextParagraph.class.isInstance(n)) {
      para = (OdfTextParagraph) n;
    } else {
      para = newParagraph();
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

  @Test
  public void testCreatChildrenForForm() {
    try {
      OdfTextDocument doc = OdfTextDocument.newTextDocument();
      OfficeTextElement text = doc.getContentRoot();
      FormFormElement form = text.newOfficeFormsElement().newFormFormElement();
      form.setFormNameAttribute("NewFrom");
      OdfFileDom contentDom = doc.getContentDom();
      XPath xpath = contentDom.getXPath();
      FormFormElement formTest = (FormFormElement) xpath.evaluate("//form:form[last()]", contentDom, XPathConstants.NODE);
      Assert.assertEquals(formTest, form);
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

   *             <code>Paragraph.newParagraph(ParagraphContainer)</code>
   * @see Paragraph#newParagraph(ParagraphContainer)
   * @see #addParagraph(String)
   */
  public OdfTextParagraph newParagraph() throws Exception {
    OfficeTextElement odfText = getContentRoot();
    return (OdfTextParagraph) odfText.newTextPElement();
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

   * @see Paragraph#appendTextContentNotCollapsed(String)
   * @see #getParagraphByIndex(int, boolean)
   * @see #getParagraphByReverseIndex(int, boolean)
   */
  public OdfTextParagraph addText(String text) throws Exception {
    OfficeTextElement odfText = getContentRoot();
    Node n = odfText.getLastChild();
    OdfTextParagraph para;
    if (OdfTextParagraph.class.isInstance(n)) {
      para = (OdfTextParagraph) n;
    } else {
      para = newParagraph();
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

      if (isForeignNode) // not in a same document
        newSectionEle = (TextSectionElement) cloneForeignElement(newSectionEle, getContentDom(), true);

      updateNames(newSectionEle);
      updateXMLIds(newSectionEle);
      OfficeTextElement contentRoot = getContentRoot();
      contentRoot.appendChild(newSectionEle);
      return Section.getInstance(newSectionEle);
    } catch (Exception e) {
      Logger.getLogger(TextDocument.class.getName()).log(Level.SEVERE, null, e);
    }
    return null;
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

      OdfStyle style = styles.newStyle(OdfStyleFamily.Paragraph);
      style.newStyleParagraphPropertiesElement().setFoBreakBeforeAttribute(breakAttribute);
      if(refParagraph == null){
        pEle = getContentRoot().newTextPElement();
      } else {
        OfficeTextElement contentRoot = getContentRoot();
        pEle = contentRoot.newTextPElement();
        OdfElement refEle = refParagraph.getOdfElement();
        contentRoot.insertBefore(pEle, refEle.getNextSibling());
      }
      pEle.setStyleName(style.getStyleNameAttribute());
    } catch (Exception e) {
      Logger.getLogger(TextDocument.class.getName()).log(Level.SEVERE, null, e);
      throw new RuntimeException(breakAttribute + "Break appends failed.", e);
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

      style.setStyleMasterPageNameAttribute(master.getName());

      if (refParagraph == null) {
        pEle = getContentRoot().newTextPElement();
      } else {
        OfficeTextElement contentRoot = getContentRoot();
        pEle = contentRoot.newTextPElement();
        OdfElement refEle = refParagraph.getOdfElement();
        contentRoot.insertBefore(pEle, refEle.getNextSibling());
      }
      pEle.setStyleName(style.getStyleNameAttribute());
    } catch (Exception e) {
      Logger.getLogger(TextDocument.class.getName()).log(Level.SEVERE,
          null, e);
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.element.office.OfficeTextElement

   *            true:copy the styles in source document to current TextDocment.
   *            false:don't copy the styles in source document to current TextDocment.
   */
  public void insertContentFromDocumentAfter(TextDocument sourceDocument, Paragraph referenceParagraph, boolean isCopyStyle){
    try {
      OfficeTextElement sroot = sourceDocument.getContentRoot();
      NodeList clist = sroot.getChildNodes();
      for (int i=(clist.getLength()-1); i>=0; i--) {
        OdfElement node = (OdfElement) clist.item(i);
        if(isCopyStyle){
          insertOdfElement(referenceParagraph.getOdfElement(), sourceDocument, node, false);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.