.ENT 生成word 图片怎么插入,在线等待

全局变量 全局变量 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

int collcount = 0;//行数
int collColumn = 0;//列
for (int i = 0; i < allCount; i++)
{
collColumn++;
if ((i % 4) == 0)//4个换行
{
collcount++;
}
#region 绘制表格
////纵向合并单元格
newTable.Cell(collcount, collColumn - ((collcount - 1) * 4)).Select();//选中
string imgUrl = @"D:\titan_oa\TitanOA\media\UGG\women\leather\5116-black_2.jpg";
object linkToFile = false;
object saveWithDcountent = true;
object anchor = Doc.Application.Selection.Range;
Doc.Application.ActiveDocument.InlineShapes.AddPicture(imgUrl, ref linkToFile, ref saveWithDcountent, ref anchor);
Doc.Application.ActiveDocument.InlineShapes[1].Width = 100f;//图片宽
Doc.Application.ActiveDocument.InlineShapes[1].Height = 100f;//图片高
//设置四周环绕
Shape s = Word.Application.ActiveDocument.InlineShapes[1].ConvertToShape();
s.WrapFormat.Type = WdWrapType.wdWrapSquare;
newTable.Cell(collcount, collColumn - ((collcount - 1) * 4)).Range.Text = dt.Rows[i]["ProductAttributeName"].ToString();
newTable.Cell(collcount, collColumn - ((collcount - 1) * 4)).Range.Bold = 2;//设置粗体
Word.Selection.Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalCenter;//设置垂直居中
Word.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;//设置水平居中
#endregion
}
#endregion


我把newTable.Cell(collcount, collColumn - ((collcount - 1) * 4)).Select();//选中 去掉就全加到第一个单元格le
要怎么样向每个单元格添加图片.
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
全局变量
.NET社区 62,275 成员 668,968 内容