Hi:
We use your Aspose.Words product quite a bit to produce reports within our (c#-based system). We always use your documentbuilder object.
The majority of our reports will be numbered using a numbering scheme beginning at 1 and increasing by one until the last page is produced. Thus for a three page report the page numbering (produced in a footing) would be as follows:
‘Page 1 of 3’
‘Page 2 of 3’
‘Page 3 of 3’
This works just fine for us using the NUMPAGES object that you provide.
Our problem is that we occasionally have reports that print on one page only and, when these reports occur the page numbering prints as follows:
‘Page 1 of xxx’
Rather than:
‘Page 1’
Or, alternatively, no page numbering at all. How is this accomplished?
Thank you for your help on this matter.
Hi
Thanks for your request. MS Word should update fields like PAGE and NUMPAGES during opening the document.
If this occurs only with one page reports as you mentioned, maybe you can try using Document.PageCount property to check number of pages in the document and avoid inserting NUMPAGES field if there is only one page in the report.
https://reference.aspose.com/words/net/aspose.words/document/pagecount/
Best regards,
Thanks for the suggestion. I have noticed that the Aspose.Words object should contain a PageCount property and I agree that if we could query that to see how large our document is we might be able to solve our problem.
However it seems that the PageCount property is not available to us. Here is the code that we use to create the Aspose.Words.Document object…
// Create an "empty" document. Note that as in Microsoft Word, the empty document has
// one section, body and one paragraph in it.
Document doc = new Document();
and the PageCount Property seems not to be available at any time.
We do use a DocumentBuilder Object to generate our reports and I’m wondering if this might have any affect. Actually the document object is referred to very rarely in the code - pretty much only when creating the documentbuilder and saving the document (using the document.save() method.
Can you advise me further on what I am doing wrong. I will include the code-behind from the program
Hi
Thanks for your request. This feature is available in Aspose.Words starting from 6.0.0 version. Which version do you use? To check version of the library, right click on the dll, select Properties from the context menu, then select Version tab. You will see File version.
In additional, note, every Aspose license carries one-year subscription for free upgrades to new versions released during this time. So, please check the expiration date of your license and upgrade to the newest version. To check an expiration date of your license open the license file using notepad. You will see the following tags:
<SubscriptionExpiry>20090218</SubscriptionExpiry>
It means that you can free upgrade to version of Aspose.Words published before 02/18/2009.
Best regards.
Thank you for the information. Yes we are running version 5.2.1.0, which does not seem to support the property and probably other things as well. and the sunscription Entry node in the license indicates that we are good for a few more days - until July 8, 2009.
I will be talking to my supervisors about this. We are a rather lerge company and I would imagine that they would want to renew their arrangement with you.
In the meantime might I ask you this? We have developed quite a bit of reporting logic using the 5.2.1.0 version of your product. On the whole it works reasonably well with an occasional non-fatal problem here and there. My one main concern with upgrading would be that it suddenly introduces a large number of issues that we had not previously not seen. Do you believe that your later product is sufficiently stable to allow us to upgrade without these concerns?
Hi
Thanks for your request. Before realizing new each version of Aspose.Words we perform a lot of testing. So I do not think that upgrading to the latest version of Aspose.Words will somehow break your existing functionality. Please let me know in case of any issues, I will be glad to help you.
Best regards.
Thanks for all your help. We are making arrangements with your organization to update our subscription as we are very happy with your product.
Since our last correspondence I have acquired the latest release and am pleased to report that now the PageCount property of the document object is available. This allows us to modify one line of our code as follows:
builder.InsertField("NUMPAGES", doc.PageCount.ToString());
The affect of this change is to produce the desired ‘Page 1 or 1’ count at the bottom of single-page reports while still allowing for ‘Page 1 of n’, ‘Page 2 of n’, and ‘Page 3 of n’ for reports that are n Pages in length. This is exactly what we were seeking.
Thanks for your help on this one. (I will have another directly — but you have a fine product and do a great job with support).