<w:r/>
<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");
documentPart.addStyledParagraphOfText("Heading2", "Hello 2");