Filling fields in Word using c# and Microsoft Word Interop

北战南征 提交于 2019-11-30 17:48:58

You should use:

doc = Word.Documents.Add(filename);

Instead of:

doc = Word.Documents.Open(filename);

So Word will use the template to create a document file, and not open the template itself. It seems Word behaves differently when the active document is a Template.

Asieh hojatoleslami

Use that, it should work:

Word.Application WordApp;
Word.Document WordDoc;

object misValue = System.Reflection.Missing.Value;

WordApp = new Word.ApplicationClass();
WordDoc = WordApp.Documents.Open(filePath2, misValue, misValue, misValue, misValue, misValue,
        misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
WordDoc.Activate();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!