Hi Aspose,
Seems that UpdatePageLayout() method doesn’t use margins or line spacing information for it’s work.
The page numbers are incorrect.
Please see result.docx attached, pages 27, 28, 40 - highlighted text.
issue.zip (149.6 KB)
Source code:
var document = new Document("C:\\test.docx"); var builder = new DocumentBuilder(document); var insertedFields = new List<Field>(); foreach (var paragraph in document.GetChildNodes(NodeType.Paragraph, true)) { builder.MoveTo(paragraph); Field insertedField = builder.InsertField(@"PAGE", "1"); insertedFields.Add(insertedField); } document.UpdatePageLayout(); insertedFields.ForEach(field => field.Update()); document.Save("C:\\result.docx", SaveFormat.Docx);
Thanks.