Package org.odftoolkit.simple

Examples of org.odftoolkit.simple.Document


   *             if content DOM could not be initialized
   */
  public Section appendSection(String name) {
    TextSectionElement newSectionEle = null;
    try {
      Document doc = (Document) ((OdfFileDom) headerEle
          .getOwnerDocument()).getDocument();
      OdfContentDom contentDocument = doc.getContentDom();
      OdfOfficeAutomaticStyles styles = contentDocument
          .getAutomaticStyles();
      OdfStyle style = styles.newStyle(OdfStyleFamily.Section);
      StyleSectionPropertiesElement sProperties = style
          .newStyleSectionPropertiesElement();
View Full Code Here


   *           is the row index of the last cell in this cell range.
   */
  CellRange(Table table, int startColumn, int startRow, int endColumn, int endRow) {
    maOwnerTable = table;

    Document doc = (Document) ((OdfFileDom) maOwnerTable.getOdfElement().getOwnerDocument()).getDocument();
    if (doc instanceof SpreadsheetDocument) {
      mbSpreadsheet = true;
    }

    //the first cell is the covered cell, then the cell range should be enlarged
View Full Code Here

   * Get the format string of the field.
   *
   * @return the format string of the field
   */
  public String getFormatString(OfficeValueTypeAttribute.Value typeValue) {
    Document mDocument = ((Document) ((OdfFileDom) mElement
        .getOwnerDocument()).getDocument());

    if (typeValue == OfficeValueTypeAttribute.Value.FLOAT) {
      String name = getDataDisplayStyleName();
      OdfNumberStyle style = drawingShape.getOdfElement()
View Full Code Here

   * @see org.odftoolkit.odfdom.dom.DefaultElementVisitor#visit(org.odftoolkit.odfdom.dom.element.draw.DrawObjectElement)
   */
  @Override
  public void visit(DrawObjectElement element) {
    String embedDocPath = element.getXlinkHrefAttribute();
    Document embedDoc = ((Document) (((OdfContentDom) element.getOwnerDocument()).getDocument()))
        .getEmbeddedDocument(embedDocPath);
    if (embedDoc != null) {
      try {
        mTextBuilder.append(EditableTextExtractor.newOdfEditableTextExtractor(embedDoc).getText());
      } catch (Exception e) {
View Full Code Here

   * @return true if the form control is successfully removed; false if
   *         otherwise.
   */
  public boolean remove() {
    try {
      Document mOwnerDocument = (Document) ((OdfFileDom) mElement
          .getOwnerDocument()).getDocument();
      if (getDrawControl() == null)
        loadDrawControl(mOwnerDocument.getContentRoot());
      getDrawControl().remove();
      formElement.removeChild(getOdfElement());
      mOwnerDocument.removeElementLinkedResource(getOdfElement());
      return true;
    } catch (Exception e) {
      Logger.getLogger(FormControl.class.getName()).log(Level.SEVERE,
          "fail to remove this element.");
      return false;
View Full Code Here

   *            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

    if (template == null)
      throw new IllegalArgumentException(
          "The template cannot null to be applied to a table.");

    Document doc = this.getOwnerDocument();
    OdfOfficeAutomaticStyles styles = doc.getContentDom()
        .getAutomaticStyles();

    // decide row style or column style
    boolean isEqualTableStyle = true;
    boolean isEqualParaStyle = true;
View Full Code Here

        + "KIND, either express or implied.  See the License for the \n"
        + "specific language governing permissions and limitations \n"
        + "under the License.";
    for (File file : files) {
      try {
        Document doc = Document.loadDocument(file);
        OdfFileDom metadom = doc.getMetaDom();
        Meta metadata = new Meta(metadom);
        String key = "License";
        metadata.removeUserDefinedDataByName(key);
        // org.odftoolkit.odfdom.dom.attribute.meta.MetaValueTypeAttribute.Value
        metadata.setUserDefinedData(key, Value.STRING.toString(),
            license);
        doc.save(file);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
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.