[C#] 纯文本查看 复制代码 public string GetDocumentBookmarkData(string FileName)
{
this.OpenWordDoc(FileName, ref wordDoc, ref wordApp);
object missing = System.Reflection.Missing.Value;
string str = "";
System.Collections.IEnumerator enu = wordApp.ActiveDocument.Bookmarks.GetEnumerator();
while (enu.MoveNext())
{
Microsoft.Office.Interop.Word.Bookmark bk = (Microsoft.Office.Interop.Word.Bookmark)enu.Current;
string str1 = bk.Range.Text;
str += "{" + bk.Name.ToString() + ":" + bk.Range.Text + "}";
}
return str;
}
上面是获取书签能容 , 然后你把你的richtextbox 的内容拼接到书签内容后面,
然后重新生成word |