Update on PageRef field codes run for infinite duration

Hi,

We have a certain requirement regarding updating the field codes in the word document.
We are updating the following field codes in the below sequence.

  1. Update TOC

  2. Update Ref field

  3. Update PageRef fields

@Test

public void testUpdateFieldCodes() throws Exception {
Document doc = new Document(“SampleDocument.docx”);
for (FieldStart start :(Iterable)doc.getChildNodes(NodeType.FIELD_START, true)) {
if (start.getFieldType() == FieldType.FIELD_TOC) {

            Field field = start.getField();
            field.update();
        }
    }
for (FieldStart start : (Iterable)doc.getChildNodes(NodeType.FIELD_START, true)) {
 if (start.getFieldType() == FieldType.FIELD_REF) {

 Field field = start.getField();
 field.update();
 }
 }
 for (FieldStart start : (Iterable)doc.getChildNodes(NodeType.FIELD_START, true)) {
 if (start.getFieldType() == FieldType.FIELD_PAGE_REF) {

 Field field = start.getField();
 field.update();
 }
 }
 }

The above code snippet runs for an infinite duration. Kindly have a look into the issue.
Attaching the sample word document in the attachment.ASPOSE POST DOCS.zip (1.9 MB)

Thanks
Manisha

@oraspose,

For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-21532. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Hi,

I have one more concern here regarding REF fields. There are several REF fields present in the attached document and each REF field takes about 1.6 minutes to update. So, if there are 10 REF fields in the document then it takes 16 minutes to update all the REF fields which is a huge hit in terms of performance.

It would be great if you can look into this as well.

Thanks
Manisha

@oraspose,

We have logged your concern/question in our issue tracking system and will keep you posted here on any further updates.

Hi,

Do we have any update on this?

Thanks
Manisha

@oraspose,

We are currently investigating the issue. The document you provided is huge and contains 631 pages before fields update.

How much time does Aspose.Words require to update a REF field? It seems not possible to provide a precise answer to this. It depends. If you create a simple document with a single REF field, the update will be instant. However, as your document is really big. We are investigating as to why the update of each REF field takes so long. We will keep you posted here on any further updates.

@oraspose,

Please provide a little more information about the following:

  • You state that PAGEREF update is what causes an infinite loop, but how do you determine that? Did you wait until the 340 REF fields got updated (which takes enormous amount of time)?
  • What is the purpose of such update requirements? If you could use a global fields update via UpdateFields() that would not be that terribly slow.

Thanks for your cooperation.

Thank Hafeez for looking into the issue.

Please find the answers below:

  1. I added print statements after the update of each type of field code (TOC, REF and PAGEREF). Basically, one print statement after TOC gets updated then one print statement after REF fields get updated and then last print statement after PAGEREF fields get updated. I ran the test at night and checked in morning nearly after eight hours and found that the test was still running. In logs, I found that first two print statements got logged but the last print statement did not get logged. I do not disagree that REF fields update is taking an enormous amount of time. I am concerned about that REF fields updates too. But, PAGEREF fields update is taking an infinite amount of time.

  2. We do not want to update all field codes. We just want to update TOC, Ref and PageRef fields.

We want some solution to bring down the time ASPOSE API is taking to update REF and PAGEREF fields.

Thanks
Manisha

@oraspose,

We have logged these details in our issue tracking system and will keep you posted here on any further updates.

Hi,

Do we have any update on this?

Thanks
Manisha

@oraspose,

Your issue is currently ‘in analysis’ phase and there are no estimates available at the moment. We will inform you via this thread as soon as this issue will get resolved in future. We apologize for any inconvenience.