Package org.odftoolkit.simple

Examples of org.odftoolkit.simple.TextDocument.save()


      Span span = Span.newSpan(sel);
      TextHyperlink link = span.applyHyperlink(new URI("http://www.ibm.com"));
      DefaultStyleHandler handler = span.getStyleHandler();
      Font font1Base = new Font("Arial", FontStyle.ITALIC, 10, Color.BLACK, TextLinePosition.THROUGH);
      handler.getTextPropertiesForWrite().setFont(font1Base);
      doc.save(ResourceUtilities.newTestOutputFile("spantest.odt"));

      String content = span.getTextContent();
      Assert.assertEquals("test", content);
      span.setTextContent("new test");
      Assert.assertEquals("new test", span.getTextContent());
View Full Code Here


      String content = span.getTextContent();
      Assert.assertEquals("test", content);
      span.setTextContent("new test");
      Assert.assertEquals("new test", span.getTextContent());
      doc.save(ResourceUtilities.newTestOutputFile("spantest.odt"));

    } catch (Exception e) {
      Logger.getLogger(SpanTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail();
    }
View Full Code Here

          flag = true;
      }
      Assert.assertTrue(flag);

      //save
      doc.save(ResourceUtilities.newTestOutputFile("spantest.odt"));

    } catch (Exception e) {
      Logger.getLogger(SpanTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail();
    }
View Full Code Here

      Assert.assertEquals(t1, paragraph2);
      t1 = doc.getParagraphByReverseIndex(2, false);
      Assert.assertEquals(t1, paragraph1);
      t1 = doc.getParagraphByReverseIndex(1, true);
      Assert.assertEquals(t1, paragraph1);
      doc.save(ResourceUtilities.newTestOutputFile("testGetParagraphByIndex.odt"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

      LOGGER.info(font3.toString());
      Font font33 = paragraph3.getFont();
      if (!font33.equals(font3)) {
        Assert.fail();
      }
      doc.save(ResourceUtilities.newTestOutputFile("TestParagraphSetGetFont.odt"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail();
    }
  }
View Full Code Here

      paragraph1.setHorizontalAlignment(HorizontalAlignmentType.RIGHT);
      align = paragraph1.getHorizontalAlignment();
      Assert.assertEquals(HorizontalAlignmentType.RIGHT, align);

      doc.save(ResourceUtilities.newTestOutputFile("TestParagraphSetGetHoriAlignment.odt"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail();
    }
  }
View Full Code Here

      Assert.assertEquals(1, textParagraph.getHeadingLevel());
      textParagraph.applyHeading(true, 3);
      Assert.assertEquals(true, textParagraph.isHeading());
      Assert.assertEquals(3, textParagraph.getHeadingLevel());

      doc.save(ResourceUtilities.newTestOutputFile("TestParagraphSetGetHeading.odt"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail();
    }
  }
View Full Code Here

      TextHyperlink link3 = para3.applyHyperlink(new URI("http://odftoolkit.org"));
      link3.setTextContent("new world");
      para3.appendTextContent("_prefix");
      para3.appendTextContent("_nolink", false);

      doc.save(ResourceUtilities.newTestOutputFile("TestParagraphHyperlink.odt"));

      TextDocument textdoc = TextDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream("TestParagraphHyperlink.odt"));
      Iterator<TextHyperlink> linkList = textdoc.getParagraphByReverseIndex(1, true).getHyperlinkIterator();
      if (linkList.hasNext()) {
View Full Code Here

      List outLineList = doc.addList(outLineDecorator);
      addOutLineItem(outLineList, "", 10, outLineDecorator);
      Assert.assertEquals(ListType.NUMBER, outLineList.getType());
      outLineList.setDecorator(imageDecorator);
      Assert.assertEquals(ListType.IMAGE, outLineList.getType());
      doc.save(ResourceUtilities.getTestOutput("ListOutput.odt"));
    } catch (Exception e) {
      Logger.getLogger(ListTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

 
  @Test
  public void testReadDocumentMeta() throws Exception {
    // create a new empty document
    TextDocument textDoc = TextDocument.newTextDocument();
    textDoc.save(ResourceUtilities.newTestOutputFile("DocForMetaTest.odt"));
    textDoc.close();
    // read empty document meta
    textDoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("DocForMetaTest.odt"));
    Meta meta = textDoc.getOfficeMetadata();
    Assert.assertNotNull(meta.getGenerator());
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.