Table merging not working when using page field

I\m using Aspose.Words [Java] version 16.2.0.0 to create a header/footer for my Word document.
The style I use as a Header is in the left column al logo, in the middle a title in a bigger font and on the right side 2 columns with some information about the document.
The left and middle columns are merged from top to bottom, and the right one has just normal rows.


| LOGO | TITLE |Auteur|Henk|
| | |Date|today|
| | |_PageNr|1|
|----------|-----------|--------------|-------------|

I can enter text in those columns without problems and even fields that start with docprops.
But when I use the field PAGE or NUMPAGES to fill a column on the right side, the merge stops for the complete row. What it should have done, and that gives me the problem that when I place de PAGES/NUMPAGE on the first row, the first row will get the same height then the LOGO.What just doesn’t look good.

Is their something extra like MERGEFORMAT that I have to add to get it working.
In the attachments I’ve added a document with the wrong layout and the right layout, and a peace off java to recreate the issue.

Hi Ron,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13438. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

I also reported another bug: https://forum.aspose.com/t/35821
And the answer off that thread fixed my problem with the page number.

-----------------------------------------------------------------------
Hi Ron,

Thanks for being patient.

Regarding WORDSNET-13470, we believe the issue is with the code you’re using on your end.

The issue occurs because the code inserts a PAGE field using the InsertField() method that immediately attempts to update the field.
The field is inserted during table construction before the last row is added.

PAGE field update requires document layout update. So the layout is built before the table construction is finished and the table has only 4 rows in the layout model. Also, auto table preferred width is used for the layout because table preferred width in percent units is not set yet. Later, the layout model built with an unfinished table is used for saving to PDF.

The issue may be corrected by using InsertField() overload that does not update the field immediately:

// Do not use insertField(string) because it will build the document layout immediately, before the table construction is finished.
// lDocumentBuilder.insertField( "PAGE \* MERGEFORMAT" );
// Use insertField(string, string) instead.
lDocumentBuilder.insertField( "PAGE \* MERGEFORMAT" , null);

In order to update the field value, Document.UpdateFields() can be used before saving the document, after all the changes to the document model are done. Hope, this helps.

Hi Ron,

It is nice to hear from you that your problem has been solved. We have closed this issue as ‘Not a Bug’. Please let us know if you have any more queries.