When appending RTF documents that include an ordered list with lowercase letters then the list of the imported RTF document is continued. However, I expected the list to restart for each imported document.
Template_with_list.zip (11.7 KB)
When appending the same document several times (at least 3 times), then it lookes like this:
Some text
a) Item 1
b) Item 2
c) Item 3
Some text.
d) Item 1
e) Item 2
f) Item 3
Some text.
g) Item 1
h) Item 2
i) Item 3
instead of:
Some text
a) Item 1
b) Item 2
c) Item 3
Some text.
a) Item 1
b) Item 2
c) Item 3
Some text.
a) Item 1
b) Item 2
c) Item 3
Is there a way to fix that problem?
I used the following method for appending RTF documents:
Document dstDocument = new Document(new ByteArrayInputStream(byteArrayOfDstFile));
Document srcDocument = new Document(new ByteArrayInputStream(byteArrayOfSrcFile));
srcDocument.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);
srcDocument.getFirstSection().getHeadersFooters().linkToPrevious(false);
srcDocument.getFirstSection().getPageSetup().setRestartPageNumbering(true);
srcDocument.getSections().forEach(section -> {
Node importNode = dstDocument.importNode(section, true, ImportFormatMode.KEEP_SOURCE_FORMATTING);
dstDocument.appendChild(importNode);
});
SaveOptions saveOptions = SaveOptions.createSaveOptions(SaveFormat.RTF);
dstDocument.save(outputStream, saveOptions);
return outputStream.toByteArray();
Many thanks in advance.