We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

List numbering issue in document concatenation

Hi Tilal,

Thanks for the resolving the above issue.

After resolving this issue , we ran into another one. After splitting documents , our use case is to append the splitted documents and convert them to html and give the html to user. But the converted html is showing wrong indentation . The page 4 is showing indentation 1 instead of 5. Attaching the splitted documents. Please help.

1506321099018.zip (29.9 KB)

//code used for appending
for (Document sourceDocument : documentsToMerge) {
startdocument.appendDocument(sourceDocument, ImportFormatMode.KEEP_DIFFERENT_STYLES);
}

//code used for converting into html
HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions();
saveOptions.setExportEmbeddedCss(true);
saveOptions.setExportEmbeddedFonts(true);
saveOptions.setExportEmbeddedImages(true);
saveOptions.setExportEmbeddedSvg(true);
saveOptions.setExportFormFields(true);
saveOptions.setEncoding(StandardCharsets.ISO_8859_1);
return saveOptions;

@saurabh.arora,

Thanks for your inquiry. Please get List from any paragraphs of destination document and apply to source document paragraphs as following. It will resolve the list number issue.

com.aspose.words.List list = null;

for (Paragraph para : (Iterable<Paragraph>) dstDoc.getChildNodes(
		NodeType.PARAGRAPH, true)) {
	if (para.isListItem()
			&& para.getListFormat().getListLevelNumber() == 0) {
		list = para.getListFormat().getList();
		break;
	}
}
com.aspose.words.Document srcDoc = new com.aspose.words.Document(
		"D:\\Downloads\\1506321099018\\4.docx");
// document1.FirstSection.PageSetup.SectionStart =
// SectionStart.Continuous;

com.aspose.words.List newList = srcDoc.getLists().addCopy(list);
for (Paragraph para : (Iterable<Paragraph>) srcDoc.getChildNodes(
		NodeType.PARAGRAPH, true)) {
	if (para.isListItem()
			&& para.getListFormat().getListLevelNumber() == 0) {
		para.getListFormat().setList(newList);
	}
}
dstDoc.appendDocument(srcDoc, ImportFormatMode.USE_DESTINATION_STYLES);