Hello,
Thanks for your document.
After investigation, we find the issue lies on the text wrapping. In Word, if you apply some text wrapping style, the related height will be omitted, and since the table can't be located, it' hard to set the intermediate value. We sugget you create a textbox which can be positioned in the header and put the table(the table in the header) into it. Then, do not set the text wrapping of the table in the body. After these operations, the table in the body will be automaticaly after the header.
Code for reference;
- Code: Select all
Dim tb As Spire.Doc.Fields.TextBox = ParHdr.AppendTextBox(150, 34)
tb.Format.TextWrappingStyle = TextWrappingStyle.Square
tb.Format.HorizontalPosition = 420
tb.Format.VerticalPosition = 60
Dim tblAgenti As Table = tb.Body.AddTable(True)
tblAgenti.ResetCells(2, 2)
For i As Integer = 0 To 1
For j As Integer = 0 To 1
tblAgenti.Rows(i).Cells(j).Width = 20
tblAgenti.Rows(i).Cells(j).AddParagraph().AppendText("15321345")
Next
Next
Dim tblNote As Table = SezMacroCedola.Body.AddTable(True)
tblNote.TableFormat.LayoutType = LayoutType.Fixed
tblNote.ResetCells(50, 10)
For k As Integer = 0 To 49
For m As Integer = 0 To 9
tblNote.Rows(k).Cells(m).Width = 60
tblNote.Rows(k).Cells(m).AddParagraph().AppendText(k + "+" + m)
Next
Next
MacroCedola.SaveToFile("10462.docx", FileFormat.Docx)
MacroCedola.SaveToFile("10462.pdf", FileFormat.PDF)
Concerning the second issue(the 5th row missing), I'm still a little confused, could you share us with the word file you get(like the code I provide, you can save the file to docx first)? And also, provide the related code snippet to help us reproduce the issue.
If there's still any doubt about the first issue, please tell us.
Sincerely,
Jane
E-iceblue support team