Document doc = new Document(Server.MapPath(tempFile));
DocumentBuilder builder = new DocumentBuilder(doc);
foreach (var key in dic.Keys)
{
var repStr = string.Format("{0}", key);
if (key == "$合同内容$")
{
doc.Range.Replace(repStr, "", false, false);
Bookmark bookmark = doc.Range.Bookmarks[0];
builder.MoveToBookmark(bookmark.Name);
builder.InsertHtml(dic[key]);
}
else if (key == "$附件内容$")
{
doc.Range.Replace(repStr, "", false, false);
Bookmark bookmark = doc.Range.Bookmarks[0];
builder.MoveToBookmark(bookmark.Name);
builder.InsertHtml(dic[key]);
}
else
{
doc.Range.Replace(repStr, dic[key], false, false);
}
}
现在遇到个问题,二个定位到了一起。doc.Range.Bookmarks[1]肯定是错的。怎么正确分别定位