姓 名 $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 (Book bm in doc.Books) //就在这里 老是进不去 ,大哥大姐们哪个知道为什么啊 {
if (bm.Name == "$Name$")
{
bm.Select();
bm.Range.Text = "李俊";
} }
#endregion
word.Visible = true;
doc.PrintPreview();
{
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 (Book bm in doc.Books) //就在这里 老是进不去 ,大哥大姐们哪个知道为什么啊 {
if (bm.Name == "$Name$")
{
bm.Select();
bm.Range.Text = "李俊";
} }
#endregion
word.Visible = true;
doc.PrintPreview();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货