用C#把数据库中的记录按格式写入Word文档中。
2007-08-16 10:31
393 查看
用C#把数据库中的记录按格式写入Word文档中。
使用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);
转自:http://blog.csdn.net/duwx/archive/2004/07/05/34188.aspx
使用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);
转自:http://blog.csdn.net/duwx/archive/2004/07/05/34188.aspx
相关文章推荐
- 用C#把数据库中的记录按格式写入Word文档中
- 用C#把数据库中的记录按格式写入Word文档中
- 用C#把数据库中的记录按格式写入Word文档中
- 用C#把数据库中的记录按格式写入Word文档中。
- powerDisigner链接mysql 生成数据库物理视图,并导出word格式的数据库说明文档
- 用Access作为后台数据库支撑,书写一个用C#写入记录的案例
- C# 将Word文档格式转化成写字板格式
- Javascript 将数据库中的数据写入WORD文档的表格中
- 用Access作为后台数据库支撑,书写一个用C#写入记录的案例
- 用C#将XML中的文字数据写如WORD文档,并控制其格式(包括字体的样式和字体大小)
- 如何把数据库的内容写入到Word文档中
- word 文档的保存数据及读取,类似图片,数据库设置图片格式(image)
- C#操作Word总结(二)——设置文档格式并添加文本内容、超链接、添加图片
- 如何把数据库以二进制存储的excel,word文档写入excel,word
- 通过C#从数据库中读取内容生成WORD文档
- 【学习记录】C#保存数据至CSV文档 & DateTime格式模式控制解释
- C#程序将自己的每一个动作、异常、操作结果等都记录下来写入数据库
- 利用C#向word文档中写入数据
- C#一行代码打开任何格式的本地文档,word,ppt,mp3,remb都可以
- 如何在C#下利用RichTextBox打开一个有文字格式和图片的Word文档