【发布时间】:2016-03-19 23:38:08
【问题描述】:
我使用 Word Interop 在表格的单元格中插入一些文本。添加文本后,我想在该文本中插入一个书签。目前我可以选择整个单元格并向其插入书签,但我希望书签只属于文本。
var cell = tb.Cell(row, col);
cell.Range.Text = "MyText";
Microsoft.Office.Interop.Word.Range rng = tb.Cell(row, col).Range;
rng.Select(); // this line is useful to see the range where bookmark will be placed
rng.Bookmarks.Add("BookmarkName", rng);
【问题讨论】:
标签: c# ms-word cell office-interop