npoi2.0版本word中插入图片
来源:互联网 发布:人工智能和机器人 编辑:程序博客网 时间:2024/06/06 07:08
npoi2.0版本word中插入图片,也可以插入条码。
namespace InsertPicturesInWord
{
class Program
{
//http://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/
//http://openxmltrix.blogspot.com/
//http://stackoverflow.com/questions/7716078/formula-to-convert-net-pixels-to-excel-width-in-openxml-format
const int emusPerInch = 914400;
const int emusPerCm = 360000;
static void Main(string[] args)
{
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p2 = doc.CreateParagraph();
XWPFRun r2 = p2.CreateRun();
r2.SetText("test");
var widthEmus = (int)(400.0 * 9525);
var heightEmus = (int)(300.0 * 9525);
using (FileStream picData = new FileStream("../../image/HumpbackWhale.jpg", FileMode.Open, FileAccess.Read))
{
r2.AddPicture(picData, (int)PictureType.PNG, "image1", widthEmus, heightEmus);
}
using (FileStream sw = File.Create("test.docx"))
{
doc.Write(sw);
}
}
}
}
- npoi2.0版本word中插入图片
- NPOI2.2.0.0实例详解(十一)—向EXCEL插入图片
- word中插入visio图片
- 在10版本word中插入音乐
- word中在指定位置插入图片
- OLE方式 word中插入图片
- 使用VC向word中插入图片
- word中使用宏批量插入图片
- 用“域”来往Word中插入图片
- word如何在图片中插入文字
- qt 导出word中插入图片
- word 文本框插入图片
- word插入页眉图片
- [2] Word插入图片
- word 页眉 插入图片
- 在C#中使用NPOI2.0操作Excel2003和Excel2007
- 在C#中使用NPOI2.0操作Excel2003和Excel2007
- 在C#中使用NPOI2.0操作Excel2003和Excel2007
- 针对一个文件夹压缩成zip文件
- 使用clone( )和Cloneable接口
- Centos7 平台中对于scikit安装教程的学习
- BO 要换个HOST-地址
- c++中void指针和const指针浅析
- npoi2.0版本word中插入图片
- 反射在连接数据库的作用
- 杭州--10
- G
- 71. Simplify Path
- spring security 处理session 超时跳转到登录页面
- POJ 2689 区间素数
- 方阵旋转算法
- Hibernate关联映射