替换word 标签 可是找不到标签
A海阔天空 2009-12-23 02:25:04 姓 名 $Name$ 性 别 $Sex$ 出生年月 $Birthday$
以上是word里的内容
下面是部分程序
if (word == null)
{
word = new WordApplication();
}
object oMissing = System.Reflection.Missing.Value;
object path1 = (object)path;
Document doc = null;
doc = word.Documents.OpenOld(ref path1, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
word.Visible = true;
#region 替换书签
foreach (Bookmark bm in doc.Bookmarks) //就在这里 老是进不去 ,大哥大姐们哪个知道为什么啊 {
if (bm.Name == "$Name$")
{
bm.Select();
bm.Range.Text = "李俊";
}
}
#endregion
word.Visible = true;
doc.PrintPreview();