Free Support Forum - aspose.com

Method doc.UpdateFields() fails

Hello

The method doc.UpdateFields() returns an IndexOutOfRangeException when you have a table inside an IF field and has added new rows using the class Aspose.Words.Tables.

Greetings.

Hello

Thanks for your inquiry. Could you please attach your document and simple code here for testing? I will check the problem on my side and provide you more information.

Best regards,

Here's the code to test the document:

Sub Main()

doc = New Document("TableInsideIF.doc")

builder = New DocumentBuilder(doc)

doc.MailMerge.Execute(New String() {"FIELD"}, New Object() {"1"})

doc.Range.Replace(New Text.RegularExpressions.Regex("\[TABLE]"), New ReplaceEvaluator(AddressOf ReplaceTextMark), False)

doc.UpdateFields()

doc.Save("ResulDoc.doc")

End Sub

Function ReplaceTextMark(ByVal sender As Object, ByVal e As ReplaceEvaluatorArgs) As ReplaceAction

e.Replacement = ""

builder.MoveTo(e.MatchNode)

'get the cell where the text mark

Dim CurrentCell As Tables.Cell = builder.CurrentParagraph.ParentNode

'get the row of the cell

Dim CurrentRow As Tables.Row = CurrentCell.ParentNode

'get the table

Dim CurrentTable As Tables.Table = CurrentRow.ParentNode

'copy entire row

Dim NewRow As Tables.Row = CurrentRow.Clone(True)

'clean text mark of the new row

CType(CType(NewRow.Cells(0).FirstChild, Paragraph).FirstChild, Run).Text = ""

'add new row to the table

CurrentTable.Rows.Add(NewRow.Clone(True))

Return ReplaceAction.Replace

End Function


Greetings.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

Best regards,

The issues you have found earlier (filed as 14079) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as 14079) have been fixed in this update.