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

Free Support Forum - aspose.com

Replace fields NumPages with SectionPages doesn't works with OpenOffice


When combining documents, I replace field NumPages with SectionPages. I do this with this example.
It’s working with MS Word, but it’s doesn’t work with OpenOffice. The field is merged with “XXX”.

Could someone help me, thanks.

(Sorry for the bad english… i am french :wink:


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. It seems the problem occurs because OpenOffice Writer cannot update SECTIONPAGES fields and that is why XXX text is displayed instead of actual value.

I suppose you use SECTIONPAGES field to show number of pages in each sub document

in your merged document. Currently, using Aspose.Words, you can get number of pages in the document, so you can insert value of SECTIONPAGES field. For example, see the following code:

builder.InsertField(@"SECTIONPAGES", doc.PageCount.ToString());

Hope this helps.

Best regards.

Thank you for your reply.

I try to replace

builder.insertField(“SECTIONPAGES \* MERGEFORMAT”, “”);
builder.insertField(“SECTIONPAGES”, pageCount);
It’s working, and with OpenOffice, “XXX” are replaced with the value of “pageCount”.

I using aspose with Java, and “doc.PageCount” property does not exist. Like other people I try get the number of pages with “doc.getBuiltInDocumentProperties().getPages()”, but it always return 1 like it’s say’s with this post) that “doc.PageCount” property is not available yet with aspose for Java. Have you more informations about the availibility of this feature ?



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You are right, this feature is now only available in .NET version of Aspose.Words. We are going to support this feature in Java version before the end of this year. I will notify you as soon as it is available.

Best regards.

Very well, thank you very much.

We are happy to inform you that the first auto-ported version of Aspose.Words for Java is ready. This version supports converting documents to PDF. You can get it from here.

Best regards,
Aspose.Words team