使用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);
博客介绍了使用C#操作Word的COM组件处理文档的方法。通过创建Word.ApplicationClass实例,打开文档模板,可对文档中的表格单元格添加内容和插入图片,实现对Word文档的操作。

1876

被折叠的 条评论
为什么被折叠?



