use of org.docx4j.wml.PPrBase.Ind in project Java-Tutorial by gpcodervn.
the class NumberingTest method testUnorderedCssOnUlToIndent.
/**
* We go to some effort to honour an 'inherited' value.
*/
@Test
public void testUnorderedCssOnUlToIndent() throws Docx4JException {
this.addNumberingPart(wordMLPackage.getMainDocumentPart());
this.addStylesPart(wordMLPackage.getMainDocumentPart());
String xhtml = "<div>" + "<ul style=\"margin-left: 0.5in;\">" + "<li>List item one</li>" + "</ul>" + "</div>";
// 40px default = 600
List<Object> results = convert(xhtml, FormattingOption.IGNORE_CLASS);
wordMLPackage.getMainDocumentPart().getContent().addAll(results);
System.out.println(XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true));
System.out.println(XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getNumberingDefinitionsPart().getJaxbElement(), true, true));
P p = (P) results.get(0);
// Should be numbered, but not using our predefined list
assertTrue(p.getPPr().getNumPr() != null);
assertTrue(p.getPPr().getNumPr().getNumId() != null);
assertTrue(p.getPPr().getNumPr().getNumId().getVal().intValue() != PREDEFINED_OL_NUMID);
// TODO this shouldn't be necessary
wordMLPackage.getMainDocumentPart().getNumberingDefinitionsPart().initialiseMaps();
Ind ind = wordMLPackage.getMainDocumentPart().getNumberingDefinitionsPart().getInd(p.getPPr().getNumPr());
// System.out.println(XmlUtils.marshaltoString(ind));
assertTrue(ind.getLeft().intValue() == 1680);
}
Aggregations