c# - 使用 ContentControl 将图片附加到 Word
问题描述
我在一些内容控件中有一个 word 模板文件,其中一个是图片内容控件,用sign 标记。我在这里阅读了许多文档和一些类似我的问题,并找到了一些类似这样的代码,但它只是不起作用并且不将图片添加到文档中,我不明白问题出在哪里。
public void AddSignHidden(Microsoft.Office.Interop.Word._Document Doc, string SignImagePath)
{
ContentControls Ccontrol = Doc.SelectContentControlsByTag("__sign");
foreach (ContentControl nativeControl in Ccontrol)
{
nativeControl.Range.InlineShapes.AddPicture(SignImagePath, Type.Missing, true, Type.Missing);
}
Doc.Save();
Doc.Close();
Doc = null;
}
解决方案
推荐阅读
- javascript - 在 rxjs 中创建树形数据视图的正确方法
- javascript - 有没有办法在搜索栏中使用 php 调用模式?
- python-2.7 - 如何创建一个新字典,其中一个字典的值作为键,另一个字典的值作为值
- javascript - 使用来自 AJAX 请求的内容填充 Bootstrap 模式
- android - Unity Android - 无法为 x86_64 架构构建
- html - 如何使用 html 下载标签从谷歌存储下载公共文件
- javascript - 如何使用 openlayer 和 geoJson 文件更改地图中图标的样式
- c++ - 分配 std::function 会导致段错误
- python - 针对主表一列 spark.sql 验证 2 列中的数据
- javascript - React 组件不会随着 redux 状态的变化而更新