Package org.odftoolkit.simple

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


  @Test
  public void testGetSetPageNumber() {
    try {

      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is the first paragraph.");
      Table table = doc.addTable();
      TableProperties writeProperties = table.getStyleHandler()
          .getTablePropertiesForWrite();
      TableProperties readProperties = table.getStyleHandler()
          .getTablePropertiesForRead();
View Full Code Here


 
  @Test
  public void testSetOutlineLevel() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(TEST_DOCUMENT));
      ChapterField chapterField = Fields.createChapterField(doc.addParagraph("Chapter:").getOdfElement());
      chapterField.setOutlineLevel(1);
     
      TextChapterElement tchapterele = chapterField.getOdfElement();
      Integer level = tchapterele.getTextOutlineLevelAttribute();
      Assert.assertTrue(1 == level);
View Full Code Here

 
  @Test
  public void testGetOdfElement() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      ChapterField chapterField = Fields.createChapterField(doc.addParagraph("Chapter:").getOdfElement());
      chapterField.setOutlineLevel(1);
      TextChapterElement tchapterEle = chapterField.getOdfElement();
     
      Assert.assertNotNull(tchapterEle);
      Assert.assertEquals("chapter", tchapterEle.getLocalName());
View Full Code Here

  @Test
  public void testGetSetBorder() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph paragraph1 = doc.addParagraph("paragraph1");
     
      paragraph1.setHorizontalAlignment(HorizontalAlignmentType.JUSTIFY);
      HorizontalAlignmentType align = paragraph1.getHorizontalAlignment();
      Assert.assertEquals(HorizontalAlignmentType.JUSTIFY, align);
View Full Code Here

  @Test
  public void testNewImage() {
    try {
      // new image in text document
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph para = doc.addParagraph("");
      Image image = Image.newImage(para, ResourceUtilities.getURI("image_list_item.png"));
      image.setName("this image");
      image.setHyperlink(new URI("http://odftoolkit.org"));
      doc.save(ResourceUtilities.newTestOutputFile("imagetest.odt"));
      Iterator<Image> iter = Image.imageIterator(para);
View Full Code Here

    try {
      TextDocument doc = TextDocument.newTextDocument();
      Form form1 = doc.createForm("Form1");
      form1.createButton(doc, btnRtg, "Button", "Push Button");

      Paragraph para = doc.addParagraph("Insert a Label here.");
      Form form2 = doc.createForm("Form2");
      form2.createLabel(para, btnRtg, "Label", "Label");

      Form form3 = doc.createForm("Form3");
      Table table1 = Table.newTable(doc, 2, 2);
View Full Code Here

  @Test
  public void testGetInstanceof() {
    try {
      // new image in text document
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph para = doc.addParagraph("");
      Image image = Image.newImage(para, ResourceUtilities.getURI("image_list_item.png"));
      image.setName("this image");
      image.setHyperlink(new URI("http://odftoolkit.org"));
     
      DrawImageElement imageElement = image.getOdfElement();
View Full Code Here

  @Test
  public void testGetFrame() {
    try {
      // new image in text document
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph para = doc.addParagraph("");
      Image image = Image.newImage(para, ResourceUtilities.getURI("image_list_item.png"));
      image.setName("this image");
      image.setHyperlink(new URI("http://odftoolkit.org"));
     
      Frame imageFrame = image.getFrame();
View Full Code Here

  @Test
  public void testRemove() {
    try {
      // new image in text document
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph para = doc.addParagraph("imagePara");
      Image image = Image.newImage(para, ResourceUtilities.getURI("image_list_item.png"));
      image.setName("this test image");
      image.setHyperlink(new URI("http://odftoolkit.org"));
      //image.remove();
     
View Full Code Here

  @Test
  public void testUpdateImage() {
    try {
      // new image in text document
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph para = doc.addParagraph("updateImage test");
      Image image = Image.newImage(para, ResourceUtilities.getURI("image_list_item.png"));
      Assert.assertEquals("image/png", image.getMediaTypeString());

      //change the piceture of image.
      image.updateImage(ResourceUtilities.getURI("testA.jpg"));
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.