我有以下方法(不是我的程序)将表格数据插入到文档的末尾。我想将数据插入到文档中的书签中。如何引用该书签而不是 \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;
}