zoukankan
html css js c++ java
在asp.net生成的word文档中插入图片
我用以下方法将一个html文件保存成word文件并且再查入一张图片
object Nothing=System.Reflection.Missing.Value;
object
srcFileName=@"D:\aa.html
";
object
dstFileName=@"d:\li.doc
";
object objt=true;
Word.Application wordApp=new Word.ApplicationClass();
Word.Document wordDoc=null;
object format=Word.WdSaveFormat.wdFormatDocument;
try
{
wordDoc=wordApp.Documents.Open(ref srcFileName,ref format, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);
//图片
Word.Shape oShape= wordDoc.Shapes.AddPicture("D:\\DL_01.gif",ref Nothing,ref objt,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);
oShape.WrapFormat.Type =Word.WdWrapType.wdWrapSquare;
//将htm文件save as成doc文件
wordDoc.SaveAs(ref dstFileName,ref format, ref Nothing, ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);
}
finally
{
wordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
}
http://community.csdn.net/Expert/topic/3541/3541955.xml?temp=.7204096
查看全文
相关阅读:
Collection集合总结
JAVA泛型通配符T,E,K,V区别,T以及Class,Class的区别【转】
Runnable和Thread
jdk自带的函数式接口(配合lambda使用)
java8-接口的静态方法(static)和默认方法(default)
Java 8
java8-Stream流【转】
java8-lambda表达式
Oracle:ORA-01461报错
ASP.NET Core 入门笔记2,建立项目
原文地址:https://www.cnblogs.com/xryyforver/p/1508849.html
最新文章
【c#基础】跳转语句、using指定别名
【c#基础】ReadOnly、构造函数(this、base)、
【c基础】入门语法
【c#基础】字符串的不可变性和驻留机制
【Linux】【学习记录】 修改密码
【C#基础】 反射
【转载】【SQL】Sql Server Management Studio 18 打开闪退问题
【Window】使用技巧
【NoSql】【Redis】 Redis 命令
多线程经典面试题
热门文章
写一个简单的Makefile
C11内存管理之道:智能指针
C++ 类型转换(C风格的强制转换):
值得推荐的C/C++框架和库 (真的很强大)
linux下解压命令大全
快速排序(过程图解)
MD5算法 —— C语言实现(字符串的加密)
C/C++面试题:编写类String的构造函数、析构函数和赋值函数。
单链表反转总结篇
List
Copyright © 2011-2022 走看看