Dzwebs.Net

撰写电脑技术杂文十余年

用ASP.NET把数据库中的记录按格式写入Word文档中

Admin | 2007-10-10 22:35:31 | 被阅次数 | 9302

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

使用Word的COM组件。

Word._Application app = new Word.ApplicationClass();   
app.Visible = false;
    
object nothing = System.Reflection.Missing.Value;
object temp = Environment.CurrentDirectory + @"\resume.doc";   //文档模板

Word.Document doc = app.Documents.Open(ref temp,ref nothing,ref nothing,ref nothing,
       ref nothing,ref nothing,ref nothing, ref nothing, ref nothing,
       ref nothing,ref nothing,ref nothing,ref nothing,ref nothing,ref nothing,ref nothing);//打开模板

doc.Tables[1].Cell(1,2).Range.Text  = ""; // 给单元格添加内容

//给单元格插入图片
doc.Tables[1].Cell(1,5).Range.InlineShapes.AddPicture(ImgPath,ref nothing,ref nothing,ref nothing);

 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=34188


该杂文来自: 网站开发杂文

上一篇:Asp.net操作Excel(导入导出)-

下一篇:选择重复记录

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计