Splitting document into single page document giving incorrect output

Hi,

I am trying to split a word document into single page documents. I am getting incorrect and sometime unstable output.

I am attaching the word document. Please help.

Corporate Bylaws Revisited.docx.zip (9.6 KB)

The 4th page , indentation is wrong , it is “1” , but in doc it is 5.

Please help.

@saurabh.arora

Thanks for your inquiry. We have tested the scenario and noticed the reported issue. We are further investigating the issue and will share our findings soon.

Hi Tilal,

Is there any update. We are struck on this. Or if you could give us another way to split documents. Please help.

We have already bought the aspose license and are going live in production in 2 days.

Please help.

@saurabh.arora

Thanks for your patience. Please check following sample code snippet to restart List number from previous page. Hopefully it will help you to accomplish the task.

 Integer priviousListLevel = null;
// Save each page to the disk as a separate document.
for (int page = 1; page <= doc.getPageCount(); page++) {
	Document pageDoc = splitter.GetDocumentOfPage(page);
	pageDoc.updateListLabels();

	if (priviousListLevel != null) {

		for (Paragraph para : (Iterable<Paragraph>) pageDoc.getChildNodes(NodeType.PARAGRAPH, true))

		{

			if (para.isListItem())

			{

				com.aspose.words.List list = para.getListFormat()
						.getList();

				list.getListLevels().get(0)
						.setStartAt(priviousListLevel + 1);

				break;

			}

		}

	}

	priviousListLevel = null;

	int labelvalue = 0;

	Node[] nodes = pageDoc.getChildNodes(NodeType.PARAGRAPH, true)
			.toArray();

	for (int i = nodes.length - 1; i >= 0; i--) {

		Paragraph paragraph = (Paragraph) nodes[i];

		if (paragraph.getListFormat().isListItem() && paragraph.getListFormat().getListLevelNumber()==0) {

			ListLabel label = paragraph.getListLabel();

			labelvalue = label.getLabelValue();

			priviousListLevel = labelvalue;

			break;

		}

	}
	pageDoc.save("D:\\Downloads\\Corporate Bylaws Revisited.docx\\AW179_"+ page + ".docx");
}

A post was split to a new topic: List numbering issue in document concatenation