I am trying to add new rows with form fields into a table, but it ends with “Stack empty” error.
I use Aspose.Words for .Net 184.108.40.206.
Thanks for help.
I have tested it with the newest version 15.10.0, it does not throw the error, but it does not create the form fields either.
I am attaching the project, could you observe it, please?
I am adding the desires result.
Dim Word1 As New Document(MyDir & “Document1.docx”)<o:p></o:p>
Word1.Range.FormFields("txtOrderNr").Result = "123"
'I want to add new row(s) into the teble with the items
Dim TableWithItems As Aspose.Words.Tables.Table = DirectCast(Word1.GetChild(Aspose.Words.NodeType.Table, 0, True), Aspose.Words.Tables.Table)
Dim DocumentBuilder1 As New Aspose.Words.DocumentBuilder(Word1)
Dim intCountOfInsertedRows As Integer
'Now I want to add 10 rows and form fields in each cell, in Aspose.Words 220.127.116.11 it does not throw the error, but doesn't create any fields anyway
For intInsertedRow As Integer = 1 To 10
Dim NewTableRow As New Aspose.Words.Tables.Row(Word1)
For intCellNumber As Integer = 1 To 4
'the table row will have four cells, each will have a paragraph with a form field
'creation of a new cell and insertion of the paragraph with the form field into the cell
Dim Cell1 As New Aspose.Words.Tables.Cell(Word1)
'creation of a new paragraph and its insertion into the cell
Dim Paragraph1 As New Aspose.Words.Paragraph(Word1)
' move cursor to inside cell
'creation of a form field for each cell
Dim FormField1 As Aspose.Words.Fields.FormField
FormField1 = DocumentBuilder1.InsertTextInput("txtNewField" & intInsertedRow & intCellNumber, Aspose.Words.Fields.TextFormFieldType.Regular, "", "Hello, I am the new field!", 0)
'insertion of the cell to the table row
'insertion of the newly created row into the table behind the previously created row
TableWithItems.Rows.Insert(1 + intCountOfInsertedRows, NewTableRow)
intCountOfInsertedRows += 1
'locking the form
Word1.Save(MyDir & “out.docx”)
I understand, thank you for you kind help anyway.