Package org.odftoolkit.simple

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


  @Test
  public void testGetParagraphByIndex() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph paragraph1 = doc.addParagraph("paragraph1");
      Paragraph paragraphE = doc.addParagraph(null);
      Paragraph paragraph2 = doc.addParagraph("p2");

      Paragraph t1 = doc.getParagraphByIndex(1, false);
      Assert.assertEquals(t1, paragraph1);
View Full Code Here


  @Test
  public void testGetParagraphByIndex() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph paragraph1 = doc.addParagraph("paragraph1");
      Paragraph paragraphE = doc.addParagraph(null);
      Paragraph paragraph2 = doc.addParagraph("p2");

      Paragraph t1 = doc.getParagraphByIndex(1, false);
      Assert.assertEquals(t1, paragraph1);
      t1 = doc.getParagraphByIndex(3, false);
View Full Code Here

  public void testGetParagraphByIndex() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph paragraph1 = doc.addParagraph("paragraph1");
      Paragraph paragraphE = doc.addParagraph(null);
      Paragraph paragraph2 = doc.addParagraph("p2");

      Paragraph t1 = doc.getParagraphByIndex(1, false);
      Assert.assertEquals(t1, paragraph1);
      t1 = doc.getParagraphByIndex(3, false);
      Assert.assertEquals(t1, paragraph2);
View Full Code Here

  @Test
  public void testSetGetFont() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph paragraph1 = doc.addParagraph("paragraph1");
      Font font1 = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 12, Color.BLACK,
          StyleTypeDefinitions.TextLinePosition.THROUGH);
      paragraph1.setFont(font1);
      Font font11 = paragraph1.getFont();
      LOGGER.info(font11.toString());
View Full Code Here

      LOGGER.info(font11.toString());
      if (!font11.equals(font1)) {
        Assert.fail();
      }

      Paragraph paragraph2 = doc.addParagraph("paragraph2");
      Font font2 = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 12, Color.RED,
          StyleTypeDefinitions.TextLinePosition.UNDER);
      paragraph2.setFont(font2);
      Font font22 = paragraph2.getFont();
      LOGGER.info(font22.toString());
View Full Code Here

      LOGGER.info(font22.toString());
      if (!font22.equals(font2)) {
        Assert.fail();
      }

      Paragraph paragraph3 = doc.addParagraph("paragraph3");
      Font font3 = paragraph3.getFont();
      LOGGER.info(font3.toString());
      font3.setColor(Color.GREEN);
      font3.setFontStyle(StyleTypeDefinitions.FontStyle.BOLD);
      paragraph3.setFont(font3);
View Full Code Here

  @Test
  public void testGetSetHoriAlignment() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph paragraph1 = doc.addParagraph("paragraph1");

      paragraph1.setHorizontalAlignment(HorizontalAlignmentType.DEFAULT);
      HorizontalAlignmentType align = paragraph1.getHorizontalAlignment();
      Assert.assertEquals(HorizontalAlignmentType.DEFAULT, align);
View Full Code Here

  @Test
  public void testHyperlink() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      Paragraph para = doc.addParagraph("abc");
      TextHyperlink link1 = para.applyHyperlink(new URI("http://odftoolkit.org"));
      Assert.assertEquals("http://odftoolkit.org", link1.getURI().toString());
      Assert.assertEquals("abc", link1.getTextContent());

      String text = para.getTextContent();
View Full Code Here

      text = para.getTextContent();
      Assert.assertEquals("", text);
      para.setTextContent("no hyperlink there ");
      para.appendHyperlink("link to ibm", new URI("http://www.ibm.com"));

      Paragraph heading = doc.addParagraph("Heading1");
      TextHyperlink link2 = heading.applyHyperlink(new URI("mailto:daisy@odftoolkit.org"));
      heading.applyHeading(true, 1);

      link2.setTextContent("New Heading1");
      link2.setURI(new URI("mailto:devin@odftoolkit.org"));
View Full Code Here

      link2.setTextContent("New Heading1");
      link2.setURI(new URI("mailto:devin@odftoolkit.org"));
      Assert.assertEquals("mailto:devin@odftoolkit.org", link2.getURI().toString());

      Paragraph para3 = doc.addParagraph("world");
      TextHyperlink link3 = para3.applyHyperlink(new URI("http://odftoolkit.org"));
      link3.setTextContent("new world");
      para3.appendTextContent("_prefix");
      para3.appendTextContent("_nolink", false);
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.