Hi Craigabyss,
There is no page break in your input document. If you insert the page breaks at the end of all pages (as you can see in attached updated document), you will be able to set following save option to convert each page to a separate HTML file without using PageSplitter and output is also fine in this case.
saveOp.setDocumentSplitCriteria(com.aspose.words.DocumentSplitCriteria.PAGE_BREAK);<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />
Best Regards,
Hi
Hi Craigabyss,
We are working on the code example for your scenario and will update you soon.
Best Regards,
Hi Craigabyss,
Once you split document using PageSplitter, second page becomes another document and has no connection with the list of first page. You will have to start numbering of the list (on page two) from the ending point of list on page one (4 in this case). Following code can be used.
Aspose.Words.Lists.List list = doc.Lists[0];
<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />
// Completely customize one list level.
ListLevel level1 = list.ListLevels[0];
level1.StartAt = 4;
Best Regards,
Hi Muhammad Ijaz
pageDoc = splitter.GetDocumentOfPage(page);
pageDoc.updateListLabels();
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())
{
ListLabel label = paragraph.getListLabel();
labelvalue = label.getLabelValue();
break;
}
}
System.out.println(labelvalue);
Hi Tahir Manzoor
Document doc = new Document(MyDir + "20150504013123_2.docx");
Document pageDoc;
LayoutCollector layoutCollector;
DocumentPageSplitter splitter;
ByteArrayOutputStream output = new ByteArrayOutputStream();
HtmlSaveOptions saveOp = new HtmlSaveOptions();
saveOp.setExportImagesAsBase64(true);
saveOp.setExportTextInputFormFieldAsText(false);
saveOp.setExportTocPageNumbers(true);
saveOp.setExportPageSetup(true);
saveOp.setExportDocumentProperties(true);
saveOp.setExportRelativeFontSize(false);
layoutCollector = new LayoutCollector(doc);
doc.updatePageLayout();
splitter = new DocumentPageSplitter(layoutCollector);
byte[] outputContent;
String outputPath = "custom/output/docx";
String blockID = UUID.randomUUID().toString();
Integer priviousListLevel = null;
for (int page = 1; page <= doc.getPageCount(); page++) {
pageDoc = splitter.GetDocumentOfPage(page);
pageDoc.updateListLabels();
if (priviousListLevel != null) {
for (Paragraph para : (Iterable)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()) {
ListLabel label = paragraph.getListLabel();
labelvalue = label.getLabelValue();
priviousListLevel = labelvalue;
break;
}
}
pageDoc.save(MyDir + "Out_"+page+".html", saveOp);
}
Hi Tahir.Manzoor
Hi Tahir.Manzoor