在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);
   }
目录
相关文章
|
3月前
|
数据安全/隐私保护
.net给图片增加水印和生成图片缩略图
.net给图片增加水印和生成图片缩略图
31 0
|
测试技术 C# Windows
C# WPF 显示图片和视频显示 EmuguCv、AForge.Net测试
原文:C# WPF 显示图片和视频显示 EmuguCv、AForge.Net测试 WPF 没有用到 PictureBox, 而是用Image代替. 下面我试着加载显示一个图片 。 XAML CS Attempt 1: ImageMy_Image=newImage(Openfile.
1765 0
|
2月前
|
开发框架 前端开发 .NET
福利来袭,.NET Core开发5大案例,30w字PDF文档大放送!!!
为了便于大家查找,特将之前开发的.Net Core相关的五大案例整理成文,共计440页,32w字,免费提供给大家,文章底部有PDF下载链接。
32 1
福利来袭,.NET Core开发5大案例,30w字PDF文档大放送!!!
|
9月前
|
API
.NET指定图片地址下载并转换Base64字符串
.NET指定图片地址下载并转换Base64字符串
|
开发框架 前端开发 .NET
ASP.NET MVC增删改查带图片路径读取
ASP.NET MVC增删改查带图片路径读取
143 0
ASP.NET MVC增删改查带图片路径读取
|
开发框架 移动开发 前端开发
ASP.NET MVC中使用jQuery Ajax通过FormData对象异步提交图片文件到服务端保存并返回保存的图片路径
ASP.NET MVC中使用jQuery Ajax通过FormData对象异步提交图片文件到服务端保存并返回保存的图片路径
248 0
|
安全 数据安全/隐私保护
Glide显示不出图片,监听报javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException:
Glide框架是当前比较流行的图片加载框架,使用起来也很简单,肯定有人在使用的时候加载不出图片的,情况有多种,下面讲一下加载不出来捕获到的Exception:javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: 。出现这种情况基本上都是加载https出现的
643 0
Glide显示不出图片,监听报javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException:
|
C#
C#/VB.NET 操作Word批注(二)——如何插入图片、读取、回复Word批注内容
序 在前面的文章C# 如何插入、修改、删除Word批注一文中介绍了如何操作Word批注的一些方法,在本篇文章中继续介绍操作Word批注的方法。分以下三种情况来介绍: 1. 插入图片到Word批注 2. 读取Word批注 3.
1457 0
|
数据安全/隐私保护 存储
.NET 图片解密为BASE64
#region 图片加密          ///           /// 加密本地文件          ///           /// 读取文件的路径          /// 要输出的文件路径          /// 密钥          ///           ...
853 0
|
Web App开发 C#
C# .NET 根据Url链接保存Image图片到本地磁盘
原文:C# .NET 根据Url链接保存Image图片到本地磁盘 根据一个Image的Url链接可以在浏览器中显示一个图片,如果要通过代码将图片保存在本地磁盘可以通过以下方式: 1、首先获取图片的二进制数组。
2425 0