0

我有发布者文档用作模板。

在此处输入图像描述

如何从文件中插入图像代替“?” 图片。

可能与 MS Word 的方式相同,但我找不到。

我以这种方式访问​​该模板:

using Publisher = Microsoft.Office.Interop.Publisher;

Publisher._Application pubApp = new Publisher.Application();
Publisher.Document doc = pubApp.Open(docPath);
Publisher.Page templateCard = doc.Pages[1];
4

1 回答 1

1

基本上:

shape.PictureFormat.Replace(filePath);

找到我想出的模板图像的最佳方法是为我的图像设置替代文本并对其进行破解:

foreach (Publisher.Shape shape in currenPage.Shapes) {
    if (shape.AlternativeText == "DICKBUTT")
        //here you do your stuff
}
于 2017-01-09T10:48:39.003 回答