- Code: Select all
P docx4jParagraph = factory.createP();
R run = factory.createR();
docx4jParagraph.getContent().add(run);
pPr pPr = new PPr();
PStyle style = factory.createPPrBasePStyle();
style.setVal(styleID);
pPr.setPStyle(style);
as styleID I pass the String "berschrift1". Which I also can find in the styles.xml :
- Code: Select all
<w:style w:type="paragraph" w:styleId="berschrift1">
<w:name w:val="heading 1"/>
<w:basedOn w:val="Standard"/>
<w:next w:val="Standard"/>
<w:link w:val="berschrift1Zchn"/>
<w:uiPriority w:val="9"/>
<w:qFormat/>
<w:rsid w:val="007416DC"/>
<w:pPr>
<w:keepNext/>
<w:keepLines/>
<w:spacing w:before="480" w:after="0"/>
<w:outlineLvl w:val="0"/>
</w:pPr>
<w:rPr>
<w:rFonts w:asciiTheme="majorHAnsi" w:hAnsiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:cstheme="majorBidi"/>
<w:b/>
<w:bCs/>
<w:color w:val="365F91" w:themeColor="accent1" w:themeShade="BF"/>
<w:sz w:val="28"/>
<w:szCs w:val="28"/>
</w:rPr>
</w:style>
For my complete styles.xml please see the attached file.
Where is my fault?
Many thanks for help in advance.
Best regards,
Sandra