日期:2014-05-18  浏览次数:20884 次

急,winform如何将图片写进word模板里对应的内容??
private void ReplaceTemplateStrByDataStr(ref Word.Application oWord, ArrayList list) 
{
object oOpt = System.Reflection.Missing.Value;
object docIndex = 1;
Word.Document doc = oWord.Documents.get_Item(ref docIndex);
Word.Range oRange;
Word.Find fnd;

string o_name = list[0].ToString();  

doc.Content.Select();
fnd = oWord.Selection.Find;
fnd.ClearFormatting();
fnd.Text = "$NAME$";

  if (fnd.Execute(ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt, ref oOpt))
  {
  oRange = oWord.Selection.Range;
  this.ReplaceValue("$NAME$", o_name, oRange);
  }
}

 private void btnDocPrint_Click(object sender, EventArgs e) //将值写进word文档中
{
  ArrayList list = new ArrayList();
  list.Add("张三");  
}  

请问,如果要将图片同样写进word中的书签位置,改如何操作??

------解决方案--------------------
我只想说你的图像很帅 顺便帮顶