0
我一直在使用下面的代碼來讀取整個word文檔。在VC#2010的docx文件中逐頁閱讀
Microsoft.Office.Interop.Word.ApplicationClass wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();
//Microsoft.Office.Interop.Word.ApplicationClass wordObject = new ApplicationClass();
object file = file_path.Text; //this is the path
object nullobject = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document docs = wordObject.Documents.Open
(ref file, ref nullobject, ref nullobject, ref nullobject,
ref nullobject, ref nullobject, ref nullobject, ref nullobject,
ref nullobject, ref nullobject, ref nullobject, ref nullobject,
ref nullobject, ref nullobject, ref nullobject, ref nullobject
);
docs.ActiveWindow.Selection.WholeStory();
docs.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
//docx_contents.Text = data.GetData(DataFormats.Text).ToString();
pages = data.GetData(DataFormats.Text).ToString();
docs.Close(ref nullobject, ref nullobject, ref nullobject);
我得到了頁面中的所有變量。請建議我如何在字符串數組中逐頁閱讀?