[WORD][Paging]Update word fields

Hello,
I use Aspose word 14.7 to generate automatically word documents.
To generate there documents, I use template with a grammar associated to a request to retrieve the records.
The document is fill with the records and it’s save.
On my two first page I have a user guide to help the administrator to define the grammar in the template.
During the generation I remove there pages.
After filled all the template, I call the methods :

this.currentDocument.FirstSection.PageSetup.PageStartingNumber = 1;
this.currentDocument.UpdateFields();

and after I save my document.
To remove my 2 first page I use this code:

LayoutCollector layoutCollector = new LayoutCollector(this.currentDocument);
PageNumberFinder pageNumberFinder = new PageNumberFinder(layoutCollector);
pageNumberFinder.SplitNodesAcrossPages();
this.currentDocument = (Document)pageNumberFinder.Document.Clone(false);
foreach (Section section in pageNumberFinder.RetrieveAllNodesOnPages(PrintParameters.StartPageAfterUserGuideTemplate, this.currentDocument.PageCount, NodeType.Section))
{
    this.currentDocument.AppendChild(this.currentDocument.ImportNode(section, true));
}

When I open my document, which 2 pages, I start the page number at 3 and the numpage at 4 and not at 2…In example a document generated.
I tried to use the method UpdatePageLayout but I have no modification.

Do you have an idea to resolve my problem?
Best regards
Rabbiwan

Hi Rabbiwan,

Thanks for your inquiry. Please try upgrading to the latest version 14.8.0 and see how it goes on your end. In case the problem still remains, please create a standalone runnable console application that helps us reproduce your problem on our end and attach it here for testing. As soon as you get this simple application ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

Best regards,

Hello Awais Hafeez,
I have updated the version with the 14.8 and I have the problem yet.
I have create a small project with the problem.
Can you help me?
Best regards
Rabbiwan

Hi Rabbiwan,

Thanks for your inquiry. I tested the scenario and have managed to reproduce the same problem on my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10877. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Ok Thank you
I await your return on this.
Best Regards
Rabbiwan

Hello Awais,
I’m working with Rabbiwan and we need to know when the issue will be corrected (WORDSNET-10877). Our entry into productive env. is planned for the next month (march) and it’s urgent for us to apply the corrective before this date.
Thanks for your quick reply.
Best regards.
Raphaël BERTOLINO.
On behalf of INFOTEL
Subcontractor for Sell & Support – ICST
Phone: +33 (0)5.61.18.58.45

raphael.bertolino.external@airbus.com

Hi Raphaël,

Thanks for your inquiry, Regarding WORDSNET-10877, our development team has completed the work on your issue and has come to a conclusion that this issue and the undesired behaviour you’re observing is actually not a bug. So, we have closed this issue as ‘Not a Bug’.

The problem occurs because your code calls the Document.UpdateFields method and sets the Field.IsLocked property to true in the SectionSplitter.VisitDocumentEnd method for the source document:

public override VisitorAction VisitDocumentEnd(Document doc)
{
    doc.UpdateFields();
    foreach (HeaderFooter headerFooter in doc.GetChildNodes(NodeType.HeaderFooter, true))
    {
        foreach (Field field in headerFooter.Range.Fields)
        {
            field.IsLocked = true;
        }
    }
    ...
}

After that the code creates new one document from the source document, except first 3 pages and calls the Document.UpdateFields method which has no effect because of the Field.IsLocked properties values. So, fields stay not updated.

If we can help you with anything else, please feel free to ask.

Best regards,

Hello Awais,
Thanks a lot for your quick answer and your explanations. It’s clear.
How is it possible to follow the tickets as customer? (WORDSNET-10877 for example)
Best regards.
Raphaël

Hi Raphaël,

Thanks for your inquiry. Unfortunately, there is no direct way you can track issues by yourself. But, you are welcome to ask the issue status via forum threads. We will verify the status from our internal issue tracking system and reply you back. We apologize for any inconvenience.

Best regards,