asp.net 替换word内容 含图片希望替换后 样式不变,图片保留
Microsoft.Office.Interop.Word.Application app =new Microsoft.Office.Interop.Word.Application();
object nullobj = System.Reflection.Missing.Value;
object file = filePath;
Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(
ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj);
doc.Content.Text = doc.Content.Text.Replace(strOld, strNew);
doc.Close(ref nullobj, ref nullobj, ref nullobj);
//关闭应用
app.Quit(ref nullobj, ref nullobj, ref nullobj);
app=null;
GC.Collect();
我现在用的方法样式变了,图片丢了,想问一下有没有其他方法。