Package org.docx4j.wml

Examples of org.docx4j.wml.R$Tab


          <w:r>
            <w:fldChar w:fldCharType="end"/>
          </w:r>
        </w:p>         */       
        P paragraphForTOC = factory.createP();          
        R r = factory.createR();

        FldChar fldchar = factory.createFldChar();
        fldchar.setFldCharType(STFldCharType.BEGIN);
        fldchar.setDirty(true);
        r.getContent().add(getWrappedFldChar(fldchar));
        paragraphForTOC.getContent().add(r);

        R r1 = factory.createR();
        Text txt = new Text();
        txt.setSpace("preserve");
        txt.setValue("TOC \\o \"1-3\" \\h \\z \\u \\h");
        r.getContent().add(factory.createRInstrText(txt) );
        paragraphForTOC.getContent().add(r1);

        FldChar fldcharend = factory.createFldChar();
        fldcharend.setFldCharType(STFldCharType.END);
        R r2 = factory.createR();
        r2.getContent().add(getWrappedFldChar(fldcharend));
        paragraphForTOC.getContent().add(r2);
           
    body.getContent().add(paragraphForTOC);
   
    documentPart.addStyledParagraphOfText("Heading1", "Hello 1");
View Full Code Here


  private static void addComplexField(P p, String instrText) {
   
    org.docx4j.wml.ObjectFactory wmlObjectFactory = Context.getWmlObjectFactory();

    // Create object for r
      R r = wmlObjectFactory.createR();
      p.getContent().add( r);
          // Create object for fldChar (wrapped in JAXBElement)
          FldChar fldchar = wmlObjectFactory.createFldChar();
          JAXBElement<org.docx4j.wml.FldChar> fldcharWrapped = wmlObjectFactory.createRFldChar(fldchar);
          r.getContent().add( fldcharWrapped);
              fldchar.setFldCharType(org.docx4j.wml.STFldCharType.BEGIN);
          // Create object for instrText (wrapped in JAXBElement)
          Text text = wmlObjectFactory.createText();
          JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRInstrText(text);
          r.getContent().add( textWrapped);
              text.setValue( instrText);
              text.setSpace( "preserve");  

          // Create object for fldChar (wrapped in JAXBElement)
          fldchar = wmlObjectFactory.createFldChar();
          fldcharWrapped = wmlObjectFactory.createRFldChar(fldchar);
          r.getContent().add( fldcharWrapped);
              fldchar.setFldCharType(org.docx4j.wml.STFldCharType.END);
   
  }
View Full Code Here

      }
    }

    field.setInstr(instr);

    R r = wmlObjectFactory.createR();
    Text t = wmlObjectFactory.createText();

    r.getContent().add(t);
    field.getContent().add(r);

    t.setValue("guess");

    return field;
View Full Code Here

            afiPart.setBinaryData(paramValue.toString().getBytes());
            afiPart.setContentType(new ContentType("text/html"));
            Relationship altChunkRel = wordPackage.getMainDocumentPart().addTargetPart(afiPart);
            CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk();
            ac.setId(altChunkRel.getId());
            R run = (R) text.getParent();
            run.getContent().add(ac);
            text.setValue("");
            wordPackage.getContentTypeManager().addDefaultContentType("html", "text/html");
        } catch (Exception e) {
            throw new ReportFormattingException("An error occurred while inserting html to docx file", e);
        }
View Full Code Here

                double widthExtent = (double) image.width / oldSize.getWidthPx();
                double heightExtent = (double) image.height / oldSize.getHeightPx();
                inline.getExtent().setCx((long) (inline.getExtent().getCx() * widthExtent));
                inline.getExtent().setCy((long) (inline.getExtent().getCy() * heightExtent));
                org.docx4j.wml.Drawing drawing = new org.docx4j.wml.ObjectFactory().createDrawing();
                R run = (R) text.getParent();
                run.getContent().add(drawing);
                drawing.getAnchorOrInline().add(inline);
                text.setValue("");
            }
        } catch (Exception e) {
            throw new ReportFormattingException("An error occurred while inserting bitmap to docx file", e);
View Full Code Here

    wordMLPackage.getMainDocumentPart().addParagraphOfText("x");
    wordMLPackage.getMainDocumentPart().addParagraphOfText("x");
    wordMLPackage.getMainDocumentPart().addParagraphOfText("hello world");
    P p = (P)wordMLPackage.getMainDocumentPart().getContent().get(2);
    R r = (R)p.getContent().get(0);

    String bookmarkName = "abcd";
    bookmarkRun(p,r, bookmarkName, 123);

    wordMLPackage.getMainDocumentPart().addParagraphOfText("x");
View Full Code Here

TOP

Related Classes of org.docx4j.wml.R$Tab

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.