博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
利用Aspose.word.dll 在生产的Word中插入图片到指定位置
阅读量:4311 次
发布时间:2019-06-06

本文共 898 字,大约阅读时间需要 2 分钟。

添加引用

using Aspose.Words;

using Aspose.Words.Drawing;
using Aspose.Words.Rendering;

 

  Document doc = new Document(TempValue);//TempValue doc模板的路径

  DocumentBuilder builder = new DocumentBuilder(doc);

  Shape shape = new Shape(doc,ShapeType.Image);

  shape.ImageData.SetImage(Server.MapPath("Images/test.jpg"));

  shape.Width = 70;//设置宽和高

  shape.Height = 70;

  shape.WrapType = WrapType.None;

  shape.BehindText = true;

  //shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;

  //shape.HorizontalAlignment = HorizontalAlignment.Center;
  //shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
  //shape.VerticalAlignment = VerticalAlignment.Center;
  //shape.HorizontalAlignment = HorizontalAlignment.Center;

  builder.MoveToBookmark("PO_MyImage");

  builder.InsertNode(shape);

  doc.Save("newword.doc",SaveFormat.Doc);

 

转载于:https://www.cnblogs.com/gavin0517/p/4939650.html

你可能感兴趣的文章
0909我对编译原理的见解
查看>>
lib 和 dll
查看>>
hdu 2042 - 不容易系列之二
查看>>
Linux下设置postgresql数据库开机启动
查看>>
mysql函数技巧整理
查看>>
二叉树
查看>>
IO多路复用--epoll详解
查看>>
[线段树优化应用] 数星星Star
查看>>
表单序列化以及后台表单数据参数的提取
查看>>
SQL语句(十五)视图
查看>>
nginx 设置开机启动
查看>>
继承和组合
查看>>
小程序-----上传图片
查看>>
工作流表单自定义的误区
查看>>
带有循环功能的存储过程
查看>>
数据结构-链表插入节点
查看>>
软件项目开发流程
查看>>
常用排序算法
查看>>
DOM(文档对象模型)
查看>>
为什么要安全域,哪些区域需要单独划分安全域
查看>>