我正在尝试打开一个 word 文档,但它不起作用。我只能保存文件,可能是什么问题?
object missing = Missing.Value;
object start1 = 0;
var wordApp = new Microsoft.Office.Interop.Word.Application();
var myDoc = wordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
object doNotSaveChanges = WdSaveOptions.wdDoNotSaveChanges;
Range rng = myDoc.Range(ref start1, ref missing);
try
{
const char newLine = (char)11;
myDoc.SaveAs(ref fs,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing,
ref missing,
ref missing, ref missing, ref missing);
myDoc.Save();
myDoc.Close(ref doNotSaveChanges, ref missing, ref missing);
wordApp.Quit(ref doNotSaveChanges, ref missing, ref missing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(myDoc);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordApp);
GC.Collect();