在asp.net生成的word文档中插入图片(转)

简介: 用以下方法将一个html文件保存成word文件并且再查入一张图片object Nothing=System.Reflection.Missing.Value;    object srcFileName=@"D:\aa.
用以下方法将一个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);
   }
目录
相关文章
|
存储 SQL 开发框架
分享88个ASP贺卡图片源码,总有一款适合您
分享88个ASP贺卡图片源码,总有一款适合您
169 2
|
SQL 存储 开发框架
分享107个ASP贺卡图片源码,总有一款适合您
分享107个ASP贺卡图片源码,总有一款适合您
140 1
|
SQL 开发框架 JavaScript
分享66个ASP贺卡图片源码,总有一款适合您
分享66个ASP贺卡图片源码,总有一款适合您
179 0
|
12月前
|
开发框架 数据可视化 .NET
.NET 中管理 Web API 文档的两种方式
.NET 中管理 Web API 文档的两种方式
232 14
|
Linux C# Windows
.NET使用MiniWord高效生成Word文件
.NET使用MiniWord高效生成Word文件
471 12
|
API C#
在.NET中使用QuestPDF高效地生成PDF文档
在.NET中使用QuestPDF高效地生成PDF文档
440 0
|
SQL Oracle 关系型数据库
.NET 开源快捷的数据库文档查询和生成工具
【8月更文挑战第1天】推荐几款.NET开源数据库文档工具:1. DBDocumentor,支持多类型数据库,快速生成详尽文档;2. SqlDoc,界面简洁,自定义内容与格式;3. DBInfo,强大查询功能,支持多种导出格式。这些工具有效提升文档管理效率与质量。
246 0
|
开发框架 前端开发 .NET
福利来袭,.NET Core开发5大案例,30w字PDF文档大放送!!!
为了便于大家查找,特将之前开发的.Net Core相关的五大案例整理成文,共计440页,32w字,免费提供给大家,文章底部有PDF下载链接。
253 1
福利来袭,.NET Core开发5大案例,30w字PDF文档大放送!!!
|
SQL JavaScript 安全
基于.NET开源跨平台的文档管理系统
基于.NET开源跨平台的文档管理系统
466 0
|
JavaScript 前端开发 Linux
.Net开发的跨平台Word模板引擎
项目采用类似Vue、React模板方式,在模板定义相应的变量,再结合数据,快速生成Word文件。比如模板定义{FullName{}},项目会自动匹配键值为FullName的对象,并替换。
502 0
.Net开发的跨平台Word模板引擎