在通过 Interop 将字段添加到现有 Word 文档时,我们需要设置“数据未与文档一起存储”标志 (“\d”),但不知道该怎么做。
此示例在插入图像链接方面效果很好,但它将图像存储在文档中而不是远程存储(我们需要)。
if (doc.Bookmarks.Exists("TrackingPixel"))
{
object oBookMark = "TrackingPixel";
object newText = @"https://www.remotelocation.com/trackingpixel/secretcode";
Range rng = doc.Bookmarks.get_Item(ref oBookMark).Range;
rng.Select();
rng.Fields.Add(
Range: rng,
Type: WdFieldType.wdFieldIncludePicture,
Text: newText,
PreserveFormatting: true
);
}
任何持有将不胜感激。谢谢。