在c#中添加水印图片我有这个小代码在doc文件中添加水印图片,只有一个问题,如果我转换一次它工作正常,但如果我尝试转换另一个文件给我这个错误:RPC服务器不可用。(来自HRESULT的异常:0x800706BA)在这一步:wordFile=oWord.Documents.Open(row.filename);这是我的代码:Microsoft.Office.Interop.Word.ApplicationoWord=newMicrosoft.Office.Interop.Word.Application();文件wordFile=newDocument();//其他变量ObjectoClassType="Word.Document.8";对象oTrue=true;对象oFalse=false;ObjectoMissing=System.Reflection.Missing.Value;privatevoidBtnInserirImagem_Click(objectsender,RoutedEventArgse){foreach(MyDocsListrowindataGridList.Items){wordFile=oWord.Documents.Open(row.filename);添加水印(wordFile,row.filename);//退出应用程序oWord.Quit(refoMissing,refoMissing,refoMissing);}}privatevoidaddWatermark(Documentdoc,stringfilename){objectrefmissing=System.Reflection.Missing.Value;stringwatermarkPath=Directory.GetCurrentDirectory()+"\fundo.jpg";如果(File.Exists(watermarkPath)){objectlinkToFile=false;对象saveWithDocument=true;Wd头rFooterIndexhfIndex=WdHeaderFooterIndex.wdHeaderFooterPrimary;页眉页脚页眉页脚;对于(inti=1;i
