<ul>
<li>
Text1
</li>
<li>
<ul>
<li>
Text2
</li>
</ul>
</li>
</ul>
xHTMLImporter.setParagraphFormatting(FormattingOption.CLASS_PLUS_OTHER);
PPr xhtmlPPr = xhtmlPar.getPPr();
if (xhtmlPPr.getNumPr() != null) {
PStyle pStyle = Context.getWmlObjectFactory().createPPrBasePStyle();
pStyle.setVal("SpecifiedStyleID");
xhtmlPPr.setPStyle(pStyle);
}
<w:p>
<w:pPr>
<w:pStyle w:val="SpecifiedStyleID"/>
<w:numPr>
<w:ilvl w:val="1"/>
<w:numId w:val="31"/>
</w:numPr>
<w:spacing w:before="0" w:after="0"/>
<w:jc w:val="left"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Roboto Condensed Light" w:hAnsi="Roboto Condensed Light"/>
<w:b w:val="false"/>
<w:i w:val="false"/>
<w:color w:val="000000"/>
<w:sz w:val="24"/>
</w:rPr>
<w:t xml:space="preserve">Text</w:t>
</w:r>
</w:p>
Michael wrote:How can I find out what style Word is using when I manually edit a generated document in Word and create a new list in it?
runRPr.getRFonts().setAscii("Roboto Condensed Light");
runRPr.getRFonts().setHAnsi("Roboto Condensed Light");
jason wrote:Your approach of iterating through the paragraphs and setting the style after importing the XHTML should work.
To understand why not, we'd need to see your code and the resulting docx.
Numbering numbering = getNumberingDefinitionsPart().getJaxbElement();
for (Numbering.AbstractNum abstractNumNode : numbering.getAbstractNum() ) {
for (Lvl lvl : abstractNumNode.getLvl()) {
NumFmt numFmt = new NumFmt();
numFmt.setVal(NumberFormat.BULLET);
lvl.setNumFmt(numFmt);
}
}
jason wrote:In your sample docx, the numbering is directly applied in document.xml; it doesn't come from styles.xml
java.lang.NoSuchMethodError: org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextEntry()Lorg/apache/commons/compress/archivers/zip/ZipArchivEntry;
[INFO] --- dependency:3.7.0:tree (default-cli) @ docx4j-core ---
[INFO] org.docx4j:docx4j-core:jar:8.3.11
[INFO] +- org.apache.commons:commons-compress:jar:1.26.1:compile
but 1.3 used by MagicDraw is ancient (dating from 2011)!
Users browsing this forum: No registered users and 44 guests