我正在尝试通过 C# 打开 MS Word 文档。但是 open 方法是以只读模式打开文档。我希望在不创建 i 的另一个副本的情况下以写入模式打开文件,以便我可以将更改保存到数据库。这是打开文件的代码。
public void def()
{
Word.Application app = new Word.Application();
Word.Document dd = app.Documents.Open("C:\\hi12.docx", ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing,ref repair);
dd.TrackRevisions = true;
dd.CommandBars["Reviewing"].Controls["Reviewing Pane"].Execute();
int count = dd.Words.Count;
dd.Close(ref Nothing, ref format, ref Nothing);
}