Package org.odftoolkit.simple

Examples of org.odftoolkit.simple.Document


   *            an instance of <code>TableTableElement</code>
   * @return an instance of <code>Table</code> that can represent
   *         <code>element</code>
   */
  public static Table getInstance(TableTableElement element) {
    Document ownerDocument = (Document) ((OdfFileDom) (element.getOwnerDocument())).getDocument();
    return ownerDocument.getTableBuilder().getTableInstance(element);
  }
View Full Code Here


    return createTable(container, numRows, numCols, headerRowNumber, headerColumnNumber, 0, 0);
  }

  private static TableTableElement createTable(TableContainer container, int numRows, int numCols,
      int headerRowNumber, int headerColumnNumber, double marginLeft, double marginRight) throws Exception {
    Document document = getOwnerDocument(container);
    OdfElement containerElement = container.getTableContainerElement();
    OdfFileDom dom = (OdfFileDom) containerElement.getOwnerDocument();
    double tableWidth = getTableWidth(container, marginLeft, marginRight);

    boolean isTextDocument = document instanceof TextDocument;
View Full Code Here

   * function.
   */
  @Test
  public void testToString() {
    try {
      Document doc = Document.loadDocument(ResourceUtilities.getTestResourceAsStream("text-extract.odt"));
      EditableTextExtractor extractor = EditableTextExtractor.newOdfEditableTextExtractor(doc);
      String output = extractor.getText();
      LOG.info(output);
      int count = 0;
      int index = output.indexOf("SIMPLE");
View Full Code Here

  public boolean removeList(List list) {
    OdfElement containerElement = getListContainerElement();
    Node child = containerElement.getFirstChild();
    OdfFileDom ownerDocument = (OdfFileDom) containerElement.getOwnerDocument();
    Document doc = (Document) ownerDocument.getDocument();
    while (child != null) {
      if (child instanceof TextListElement) {
        TextListElement listElement1 = (TextListElement) child;
        String id1 = listElement1.getXmlIdAttribute();
        TextListElement listElement2 = list.getOdfElement();
        String id2 = listElement2.getXmlIdAttribute();
        if ((listElement1 == listElement2) || ((id1 != null) && (id2 != null) && (id1.equals(id2)))) {
          doc.removeElementLinkedResource(listElement1);
          containerElement.removeChild(child);
          return true;
        }
      }
      child = child.getNextSibling();
View Full Code Here

  public OdfElement getListContainerElement() {
    return getListContainerImpl().getListContainerElement();
  }

  public org.odftoolkit.simple.text.list.List addList() {
    Document ownerDocument = getTable().getOwnerDocument();
    if (ownerDocument instanceof SpreadsheetDocument) {
      throw new UnsupportedOperationException(
          "Open Office and Symphony can't show a list in spreadsheet document cell.");
    } else {
      return getListContainerImpl().addList();
View Full Code Here

      return getListContainerImpl().addList();
    }
  }

  public org.odftoolkit.simple.text.list.List addList(ListDecorator decorator) {
    Document ownerDocument = getTable().getOwnerDocument();
    if (ownerDocument instanceof SpreadsheetDocument) {
      throw new UnsupportedOperationException(
          "Open Office and Symphony can't show a list in spreadsheet document cell.");
    } else {
      return getListContainerImpl().addList(decorator);
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////// private methods ///////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
  private TableContentValidationElement getContentValidationEle() throws Exception {
    Document ownerDocument = getOwnerDocument();
    OdfElement contentRootElement = ownerDocument.getContentRoot();
    TableContentValidationsElement validations = OdfElement.findFirstChildNode(
        TableContentValidationsElement.class, contentRootElement);
    if (validations == null) {
      validations = (TableContentValidationsElement) OdfXMLFactory.newOdfElement(ownerDocument
          .getContentDom(), OdfName.newName(OdfDocumentNamespace.TABLE, "content-validations"));
      contentRootElement.insertBefore(validations, contentRootElement.getFirstChild());
    }
    String validationName = getOdfElement().getTableContentValidationNameAttribute();
    TableContentValidationElement validationElement = null;
View Full Code Here

  public OdfElement getListContainerElement() {
    return getListContainerImpl().getListContainerElement();
  }

  public org.odftoolkit.simple.text.list.List addList() {
    Document ownerDocument = getTable().getOwnerDocument();
    if (ownerDocument instanceof SpreadsheetDocument) {
      throw new UnsupportedOperationException(
          "Open Office and Symphony can't show a list in spreadsheet document cell.");
    } else {
      return getListContainerImpl().addList();
View Full Code Here

      return getListContainerImpl().addList();
    }
  }

  public org.odftoolkit.simple.text.list.List addList(ListDecorator decorator) {
    Document ownerDocument = getTable().getOwnerDocument();
    if (ownerDocument instanceof SpreadsheetDocument) {
      throw new UnsupportedOperationException(
          "Open Office and Symphony can't show a list in spreadsheet document cell.");
    } else {
      return getListContainerImpl().addList(decorator);
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////// private methods ///////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
  private TableContentValidationElement getContentValidationEle() throws Exception {
    Document ownerDocument = getOwnerDocument();
    OdfElement contentRootElement = ownerDocument.getContentRoot();
    TableContentValidationsElement validations = OdfElement.findFirstChildNode(
        TableContentValidationsElement.class, contentRootElement);
    if (validations == null) {
      validations = (TableContentValidationsElement) OdfXMLFactory.newOdfElement(ownerDocument
          .getContentDom(), OdfName.newName(OdfDocumentNamespace.TABLE, "content-validations"));
      contentRootElement.insertBefore(validations, contentRootElement.getFirstChild());
    }
    String validationName = getOdfElement().getTableContentValidationNameAttribute();
    TableContentValidationElement validationElement = null;
View Full Code Here

TOP

Related Classes of org.odftoolkit.simple.Document

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.