as the title of the topic suggests, im trying to add new rows to a table.
I managed to identify the table in this way:
- Code: Select all
dim t as Table = document.Bookmarks("something").BookmarkEnd.Owner.Owner.Owner.Owner
Is there a more elegant way to do it? I tried to do it with t.TableDescription or t.Title, but it didn't seem to work.
Anyway...
I already have a table header, and a first row inserted. So now i want to add new rows. I do it this way:
- Code: Select all
Dim row As Spire.Doc.TableRow = t.LastRow.Clone
t.Rows.Add(row)
So now i have a new row, where i can insert text values in it's cells. The problem is, that the cloned row doesn't keep it's font style, the new row will have allways Arial 10 or something. So i have to set it manually for each row:
- Code: Select all
Dim txtRange As Spire.Doc.Fields.TextRange = t.LastRow.Cells(0).Paragraphs(0).AppendText(value1)
txtRange.CharacterFormat.FontName = "Tahoma"
txtRange.CharacterFormat.FontSize = 10
Is there a way so that i can add new rows, and the font style to remain the same?
Thank you very much.