Package org.odftoolkit.odfdom.incubator.doc.style

Examples of org.odftoolkit.odfdom.incubator.doc.style.OdfStyle


      Cell cell = oldTopRow.getCellByIndex(i);
      if (cell.isCoveredElement()) {
        i = i + cell.getColumnsRepeatedNumber();
        continue;
      }
      OdfStyle styleEle = cell.getStyleHandler().getStyleElementForWrite();
      if (i < length - 1) {
        setLeftBottomBorderStylesProperties(styleEle);
      } else {
        setRightBottomBorderStylesProperties(styleEle);
      }
View Full Code Here


      Cell cell = newTopRow.getCellByIndex(i);
      if (cell.isCoveredElement()) {
        i = i + cell.getColumnsRepeatedNumber();
        continue;
      }
      OdfStyle styleEle = cell.getStyleHandler().getStyleElementForWrite();
      if (i < length - 1) {
        setLeftTopBorderStyleProperties(styleEle);
      } else {
        setRightTopBorderStyleProperties(styleEle);
      }
View Full Code Here

    TreeMap<OdfStyleProperty, String> searchProps = new TreeMap<OdfStyleProperty, String>();
    searchProps.put(StyleTextPropertiesElement.FontName, "Arial");
    searchProps.put(StyleTextPropertiesElement.FontSize, "12pt");
    search1 = new TextStyleNavigation(searchProps, doc);

    OdfStyle style = null;
    try {
      style = new OdfStyle(doc.getContentDom());
      style.setProperty(StyleTextPropertiesElement.FontSize, "23pt");
      style.setProperty(StyleTextPropertiesElement.FontWeight, "bold");
      style.setStyleFamilyAttribute("text");
    } catch (Exception e1) {
      LOG.log(Level.SEVERE, e1.getMessage(), e1);
      Assert.fail("Failed with " + e1.getClass().getName() + ": '" + e1.getMessage() + "'");
    }
View Full Code Here

    }

  }

  private void checkLoadTemplateResults(TableTemplate template, String name) {
    OdfStyle style = null;
    try {
      OdfOfficeAutomaticStyles styles = doc.getContentDom()
          .getAutomaticStyles();
      style = styles.getStyle(name + ".A1", OdfStyleFamily.TableCell);
      Assert.assertNotNull(style);
View Full Code Here

    nextSelect = (TextSelection) nextsearch.nextSelection();

    // replace all the "SIMPLE" to "Odf Toolkit"
    // except the sentence
    // "Task5.Change the SIMPLE to Odf Toolkit, and bold them."
    OdfStyle style = new OdfStyle(contentDOM);
    style.setProperty(StyleTextPropertiesElement.FontWeight, "bold");
    style.setStyleFamilyAttribute("text");
    int i = 0;
    while (search.hasNext()) {
      if (i > 0) {
        TextSelection item = (TextSelection) search.nextSelection();
        try {
View Full Code Here

      TextPElement paraLast = (TextPElement) xpath.evaluate("//text:p[last()]", contentDom, XPathConstants.NODE);
      addImageToDocument(contentDom, paraLast);

      // Access/Update automatic styles
      OdfOfficeAutomaticStyles autoStyles = embDoc.getContentDom().getAutomaticStyles();
      OdfStyle autoStyle = autoStyles.getStyle("P1", OdfStyleFamily.Paragraph);
      Assert.assertEquals(autoStyle.getStyleNameAttribute(), "P1");
      Assert.assertEquals(autoStyle.getFamilyName(), "paragraph");

      // Access/Update styles.xml
      OdfStyle documentStyle = embDoc.getDocumentStyles().getStyle("myStyle", OdfStyleFamily.Paragraph);
      Assert.assertEquals(documentStyle.getStyleNameAttribute(), "myStyle");
      Assert.assertEquals(documentStyle.getFamilyName(), "paragraph");

      documentStyle.setProperty(StyleTextPropertiesElement.FontWeight, "bold");
      documentStyle.setProperty(StyleParagraphPropertiesElement.BackgroundColor, "#14EA5D");

      // SAVE / LOAD
      docWithEmbeddedObjects.save(TEST_FILE_ACCESS_EMBEDDED);

      Document doc2 = Document.loadDocument(TEST_FILE_ACCESS_EMBEDDED);
      Document embDoc2 = doc2.getEmbeddedDocument("Object 1/");
      embDoc2.getStylesDom();
      OdfStyle documentStyle2 = embDoc2.getDocumentStyles().getStyle("myStyle", OdfStyleFamily.Paragraph);
      String prop2 = documentStyle2.getProperty(StyleTextPropertiesElement.FontWeight);
      Assert.assertEquals(prop2, "bold");

      TextSpanElement spanTest = (TextSpanElement) xpath.evaluate("//text:p[1]/text:span[1]", contentDom,
          XPathConstants.NODE);
      Assert.assertEquals(spanTest.getTextContent(), TEST_SPAN_TEXT);
View Full Code Here

   * @param style
   *       the cell style of the document
   */
  public void setDefaultCellStyle(OdfStyle style) {
    splitRepeatedRows();
    OdfStyle defaultStyle = getDefaultCellStyle();
    if (defaultStyle != null) {
      defaultStyle.removeStyleUser(maRowElement);
    }

    if (style != null) {
      style.addStyleUser(maRowElement);
      maRowElement.setTableDefaultCellStyleNameAttribute(
View Full Code Here

   *
   * @return the default cell style of this row
   */
  public OdfStyle getDefaultCellStyle() {
    String styleName = maRowElement.getTableDefaultCellStyleNameAttribute();
    OdfStyle style = maRowElement.getAutomaticStyles().getStyle(
        styleName, OdfStyleFamily.TableCell);

    if (style == null) {
      style = mDocument.getDocumentStyles().getStyle(styleName, OdfStyleFamily.TableCell);
    }
View Full Code Here

  }

  private void reviseStyleFromLastColumnToMedium(OdfTableCell oldLastCell) {
    if (getTable().mIsSpreadsheet) return;
   
    OdfStyle styleEle = oldLastCell.getCellStyleElementForWrite();
    if (styleEle != null) {
      if (oldLastCell.getRowIndex() == 0) {
        OdfTable.setLeftTopBorderStyleProperties(styleEle);
      } else {
        OdfTable.setLeftBottomBorderStylesProperties(styleEle);
View Full Code Here

  }

  private void reviseStyleFromMediumColumnToLast(OdfTableCell newLastCell) {
    if (getTable().mIsSpreadsheet) return;
   
    OdfStyle styleEle = newLastCell.getCellStyleElementForWrite();
    if (styleEle != null) {
      if (newLastCell.getRowIndex() == 0) {
        OdfTable.setRightTopBorderStyleProperties(styleEle);
      } else {
        OdfTable.setRightBottomBorderStylesProperties(styleEle);
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.incubator.doc.style.OdfStyle

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.