Examples of newOdfElement()


Examples of org.odftoolkit.odfdom.dom.OdfContentDom.newOdfElement()

   *         based on the given URI.
   * */
  public String newImage(URI imageUri) {
    try {
      OdfContentDom contentDom = this.getContentDom();
      OdfDrawFrame drawFrame = contentDom.newOdfElement(OdfDrawFrame.class);
      XPath xpath = contentDom.getXPath();
      if (this instanceof SpreadsheetDocument) {
        TableTableCellElement lastCell = (TableTableCellElement) xpath.evaluate("//table:table-cell[last()]",
            contentDom, XPathConstants.NODE);
        lastCell.appendChild(drawFrame);
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfContentDom.newOdfElement()

      sdoc = (TextDocument) doc;
    }

    protected DrawFrameElement getChartFrame() throws Exception {
      OdfContentDom contentDom2 = sdoc.getContentDom();
      DrawFrameElement drawFrame = contentDom2.newOdfElement(DrawFrameElement.class);
      TextPElement lastPara = sdoc.getContentRoot().newTextPElement();
      lastPara.appendChild(drawFrame);
      drawFrame.setTextAnchorTypeAttribute(TextAnchorTypeAttribute.Value.PARAGRAPH.toString());
      return drawFrame;
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfContentDom.newOdfElement()

   * @return         Returns the internal package path of the image, which was created based on the given URI.
   * */
  public String newImage(URI imageUri) {
    try {
      OdfContentDom contentDom = this.getContentDom();
      OdfDrawFrame drawFrame = contentDom.newOdfElement(OdfDrawFrame.class);
      XPath xpath = contentDom.getXPath();
      if (this instanceof OdfSpreadsheetDocument) {
        TableTableCellElement lastCell = (TableTableCellElement) xpath.evaluate("//table:table-cell[last()]", contentDom, XPathConstants.NODE);
        lastCell.appendChild(drawFrame);
        drawFrame.removeAttribute("text:anchor-type");
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

      throw new InvalidNavigationException("No matched string at this position");
    }
    // create annotation element
    OdfElement parentElement = getContainerElement();
    OdfFileDom dom = (OdfFileDom) parentElement.getOwnerDocument();
    OfficeAnnotationElement annotationElement = dom.newOdfElement(OfficeAnnotationElement.class);
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
    if (creator == null) {
      creator = System.getProperty("user.name");
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

    mElement = (DrawFrameElement) drawElement.getParentNode();
    if (mElement == null) {
      Logger.getLogger(Image.class.getName()).log(Level.WARNING,
          "The image has no parent frame. A new frame will be created as its parent");
      OdfFileDom ownerDom = (OdfFileDom) drawElement.getOwnerDocument();
      mElement = ownerDom.newOdfElement(DrawFrameElement.class);
      mElement.appendChild(drawElement);
    }
    mFrame = Frame.getInstanceof(mElement);
    mImageElement = drawElement;
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

    Image mImage;

    try {
      OdfElement parent = container.getFrameContainerElement();
      OdfFileDom ownerDom = (OdfFileDom) parent.getOwnerDocument();
      DrawFrameElement fElement = ownerDom.newOdfElement(DrawFrameElement.class);
      parent.appendChild(fElement);
      DrawImageElement imageElement = fElement.newDrawImageElement();
      // set uri and copy resource
      String packagePath = insertImageResourceIntoPackage((OdfSchemaDocument) ownerDom.getDocument(), uri);
      packagePath = packagePath.replaceFirst(ownerDom.getDocument().getDocumentPath(), "");
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

        OdfFileDom stylesDom = getStylesDom();
        Node parent = stylesDom != null ? stylesDom.getFirstChild() : null;
        if (parent != null) {
          mDocumentStyles = OdfElement.findFirstChildNode(OdfOfficeStyles.class, parent);
          if (mDocumentStyles == null) {
            mDocumentStyles = stylesDom.newOdfElement(OdfOfficeStyles.class);
            parent.insertBefore(mDocumentStyles, parent.getFirstChild());
          }
        }
      } catch (Exception ex) {
        Logger.getLogger(OdfSchemaDocument.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

      if (mOwnerTable.mIsSpreadsheet) {
        newImage = Image.newImage(this, imageUri);
      } else {
        OdfFileDom dom = (OdfFileDom) mCellElement.getOwnerDocument();
        TextPElement pElement = dom.newOdfElement(TextPElement.class);
        mCellElement.appendChild(pElement);
        newImage = Image.newImage(Paragraph.getInstanceof(pElement), imageUri);
      }
      if (imageUri != null) {
        FrameRectangle rect = newImage.getRectangle();
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

  public void applyHeading(boolean isHeading, int level) {
    if (isHeading) {
      if (!isHeading()) {
        // create new heading element, clone children nodes.
        OdfFileDom ownerDocument = (OdfFileDom) getOdfElement().getOwnerDocument();
        mHeadingElement = ownerDocument.newOdfElement(TextHElement.class);
        Node firstChild = mParagraphElement.getFirstChild();
        while (firstChild != null) {
          // mHeadingElement.appendChild(firstChild.cloneNode(true));
          // firstChild = firstChild.getNextSibling();
          Node thisChild = firstChild;
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement()

      mHeadingElement.setTextOutlineLevelAttribute(level);
    } else {
      if (isHeading()) {
        // need create new paragraph element and clone content.
        OdfFileDom ownerDocument = (OdfFileDom) getOdfElement().getOwnerDocument();
        mParagraphElement = ownerDocument.newOdfElement(TextPElement.class);
        Node firstChild = mHeadingElement.getFirstChild();
        while (firstChild != null) {
          Node thisChild = firstChild;
          firstChild = firstChild.getNextSibling();
          mHeadingElement.removeChild(thisChild);
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.