I have the following method(not my program) that inserts table data to the end of the document. I want to insert the data into a bookmark in the document. How do I reference that bookmark instead of the \endofdoc?
private static void CreateTable(Microsoft.Office.Interop.Word.Document oWordDoc, int RowCount, int ColumnCount, string[,] TableContent)
{
Table oTable;
object oEndOfDoc = "\\endofdoc";
object missing = System.Reflection.Missing.Value;
Range wrdRng = oWordDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oTable = oWordDoc.Tables.Add(wrdRng, RowCount, ColumnCount, ref missing, ref missing);
oTable.ID = "ContentTable";
int r, c;
for (r = 0; r < RowCount; r++)
for (c = 0; c < ColumnCount; c++)
{
oTable.Cell(r + 1, c + 1).Range.Text = TableContent[r, c];
}
//oTable.Rows[1].Range.Font.Bold = 1;
oTable.Borders.OutsideLineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleThickThinLargeGap;
oTable.Borders.InsideLineStyle = Microsoft.Office.Interop.Word.WdLineStyle.wdLineStyleSingle;
}
The following code was culled from c-sharpcorner which should get you started with dealing with bookmarks.