I'm working with the Microsoft.Office.Interop.Word (v14.0).
I have a word document.
In that word document I created a table with 3 Columns and added 1 row to the table.
Each of the 3 cells in the first row are containing a field. When the user press print button on my Window/Form I take the informations (positions, with 3 attributes in my UI context) and use Microsoft word template, my word document that has this row with the 3 cells to be filled with these info coming from WPF Window / (same as Windows Forms).
Actually, the problem is, I don't know how I can copy an existing tablerow. The quantity of positions (describing one Row), can be different and I search a way, how to copy an existing row, with these 3 fields in it and add it just at the bottom. Or an other way would be, to create a row, and these fields, foreach cell, dynamically.. Anyway
How can I do that?
Well, adding rows doesn't seem to be a problem (Code from MSDN):
object beforeRow = this.Tables.Rows;
Edit: something like this might work: I'm not sure what should be passed as the
Range parameter to
object beforeRow = this.Tables.Rows; Row newRow = this.Tables.Rows.Add(ref beforeRow); Field fld = beforeRow.Cells.Range.Fields; Range range = fld.Range; // newRow.Cells.Range ? newRow.Cells.Range.Fields.Add(ref range, ref fld.Type, ref missing, ref missing);