Fix various issues with word/PDF export
This commit is contained in:
parent
39795f177f
commit
db4d1006c6
|
@ -171,7 +171,7 @@ public class HtmlToWorldBuilder implements NodeVisitor {
|
|||
break;
|
||||
case "br":
|
||||
if (stringBooleanEntry.getValue()) {
|
||||
this.run.addCarriageReturn();
|
||||
this.run.addBreak();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ public class WordBuilder {
|
|||
});
|
||||
this.options.put(ParagraphStyle.HTML, (mainDocumentPart, item) -> {
|
||||
Document htmlDoc = Jsoup.parse(item.replaceAll("\n", "<br>"));
|
||||
HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convert(mainDocumentPart, htmlDoc, 0.5F);
|
||||
htmlToWorldBuilder.getParagraph().setIndentationLeft(0);
|
||||
HtmlToWorldBuilder htmlToWorldBuilder = HtmlToWorldBuilder.convert(mainDocumentPart, htmlDoc, 0.8F);
|
||||
return htmlToWorldBuilder.getParagraph();
|
||||
});
|
||||
this.options.put(ParagraphStyle.TITLE, (mainDocumentPart, item) -> {
|
||||
|
@ -132,8 +131,16 @@ public class WordBuilder {
|
|||
|
||||
public XWPFDocument build(XWPFDocument document, PagedDatasetProfile pagedDatasetProfile, VisibilityRuleService visibilityRuleService) throws IOException {
|
||||
createPages(pagedDatasetProfile.getPages(), document, true, visibilityRuleService);
|
||||
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
|
||||
XWPFNumbering numbering = document.createNumbering();
|
||||
BigInteger tempNumId = BigInteger.ONE;
|
||||
boolean found = false;
|
||||
while (!found) {
|
||||
Object o = numbering.getAbstractNum(tempNumId);
|
||||
found = (o == null);
|
||||
if (!found) tempNumId = tempNumId.add(BigInteger.ONE);
|
||||
}
|
||||
cTAbstractNum.setAbstractNumId(tempNumId);
|
||||
XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum);
|
||||
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
|
||||
this.numId = numbering.addNum(abstractNumID);
|
||||
createPages(pagedDatasetProfile.getPages(), document, false, visibilityRuleService);
|
||||
|
@ -252,13 +259,16 @@ public class WordBuilder {
|
|||
}
|
||||
if (question) {
|
||||
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
|
||||
cTLvl.addNewLvlText().setVal("");
|
||||
cTLvl.setIlvl(BigInteger.valueOf(indent));
|
||||
} else if (!question && hasIndication) {
|
||||
cTLvl.addNewNumFmt().setVal(STNumberFormat.DECIMAL);
|
||||
cTLvl.addNewLvlText().setVal("");
|
||||
cTLvl.setIlvl(BigInteger.valueOf(indent));
|
||||
}
|
||||
if (!question && !hasIndication) {
|
||||
cTLvl.addNewNumFmt().setVal(STNumberFormat.NONE);
|
||||
cTLvl.addNewLvlText().setVal("");
|
||||
cTLvl.setIlvl(BigInteger.valueOf(indent));
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +347,9 @@ public class WordBuilder {
|
|||
return data.getLabel();
|
||||
case "freetext":
|
||||
case "datepicker":
|
||||
case "datePicker":
|
||||
case "textarea":
|
||||
case "richTextarea":
|
||||
return field.getValue() != null ? field.getValue().toString(): "";
|
||||
case "datasetIdentifier":
|
||||
case "validation":
|
||||
|
|
Loading…
Reference in New Issue