Hi Aspose team.
Sorry for bringing up this old post.
Aspose word .NET version: 22.11.0
I have re-use the logic suggested by Mr. Alexey Noskov in the previous comment, and it is working fine for adding new rows in an existing table.
The only issue I have is that all the page number for the subsequent rows after adding the new row, they are still retaining their page number before the row addition.
Illustration sample -
Condition:
- Page can only contain a maximum of 3 rows.
- Sample data of 3 pages.
Original -
page 1 have:
- row 1A
- row 1B
- row 1C
Page 2 have:
- row 2A
- row 2B
- row 2C
Page 3 have:
- row 3A
- row 3B
- row 3C
After adding new rows-
page 1 have:
- row 1A
- row 1B
- row 1C
Page 2 have:
- NewRow1
- row 2A
- row 2B
Page 3 have:
- row 2C - GetStartPageIndex on this row still show 2
- NewRow2 - This is added here instead
- row 3A
Page 4 have:
- row 3B - GetStartPageIndex on this row still show 3
- row 3C - GetStartPageIndex on this row still show 3
I have tried multiple ways to refresh the page number but none is working for me:
collector.Clear();
doc.UpdatePageLayout();
collector = new LayoutCollector(doc); - reinitializing LayoutCollector
Try getting page number from enumerator:
LayoutEnumerator enumerator = new LayoutEnumerator(doc);
enumerator.Current = collector.GetEntity(row);
var enumPageNumber = enumerator.PageIndex;
Can I check with you guys, is there something I am doing wrong here, or if a version upgrade could fix this?
Hope to hear from you guys soon.
Thanks.
Regards
Joseph