Examples of addParagraphOfText()


Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

   
    // Example 1: add text in Title style
    mdp.addStyledParagraphOfText("Title", "Example 1");

    // Example 2: add normal paragraph (no explicit style)
    mdp.addParagraphOfText("Example 2");
   
    // Example 3a: bold text
    // To get bold text, you must set the run's rPr@w:b,
      // so you can't use the addParagraphOfText convenience method
   
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

      // is a better alternative if you are using a new style, since it
      // will ensure that the style is activated 

    // Example 3b: bold text
      // Well, actually you can use addParagraphOfText:
    P p3b = mdp.addParagraphOfText("Example 3b (bold)");
    R r3b = (R)p3b.getContent().get(0);
      // .. now set rPr (I'll just reuse the above object)
    r3b.setRPr(rpr);

     
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

   
    // Example 1: add text in Title style
    mdp.addStyledParagraphOfText("Title", "Example 1");

    // Example 2: add normal paragraph (no explicit style)
    mdp.addParagraphOfText("Example 2");
   
    // Example 3a: bold text
    // To get bold text, you must set the run's rPr@w:b,
      // so you can't use the addParagraphOfText convenience method
   
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

      // is a better alternative if you are using a new style, since it
      // will ensure that the style is activated 

    // Example 3b: bold text
      // Well, actually you can use addParagraphOfText:
    P p3b = mdp.addParagraphOfText("Example 3b (bold)");
    R r3b = (R)p3b.getContent().get(0);
      // .. now set rPr (I'll just reuse the above object)
    r3b.setRPr(rpr);

     
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

    org.docx4j.wml.ObjectFactory factory = Context.getWmlObjectFactory();

    int i = 1;
    for (SwitchTestQuad tt : quads) {
      //org.docx4j.wml.P  p = factory.createP();
      org.docx4j.wml.P  p = mdp.addParagraphOfText(tt.val  +" " +  tt.format + " --> ");
     
      p.getContent().add(createSimpleField(tt, "myvar"+i, true));
     
      // Ok, let's add a custom property.
      org.docx4j.docProps.custom.Properties.Property newProp = cpfactory.createPropertiesProperty();
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

  public static void main(String[] argsthrows Exception {

    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
    MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();
   
    mdp.addParagraphOfText("Paragraph 1");

    // Add the XHTML altChunk
    String xhtml = "<html><head><title>Import me</title></head><body><p>Hello World!</p></body></html>";
    mdp.addAltChunk(AltChunkType.Xhtml, xhtml.getBytes());
   
View Full Code Here

Examples of org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.addParagraphOfText()

    // Add the XHTML altChunk
    String xhtml = "<html><head><title>Import me</title></head><body><p>Hello World!</p></body></html>";
    mdp.addAltChunk(AltChunkType.Xhtml, xhtml.getBytes());
   
    mdp.addParagraphOfText("Paragraph 3");
   
    // Round trip
    WordprocessingMLPackage pkgOut = mdp.convertAltChunks();
   
    // Display result
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.