How to use interop for reading word document and get page number?

Posted by monkey_boys on Stack Overflow See other posts from Stack Overflow or by monkey_boys
Published on 2010-05-01T08:45:30Z Indexed on 2010/05/01 8:57 UTC
Read the original article Hit count: 184

Filed under:
|
            Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
                object nullobj = System.Reflection.Missing.Value;
                object file = openFileDialog1.FileName;
                Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(
ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj);
                doc.ActiveWindow.Selection.WholeStory();
                doc.ActiveWindow.Selection.Copy();
                IDataObject data = Clipboard.GetDataObject();
                string text = data.GetData(DataFormats.Text).ToString();
                textBox2.Text = text;
                doc.Close(ref nullobj, ref nullobj, ref nullobj);
                app.Quit(ref nullobj, ref nullobj, ref nullobj);

But not have page number how to ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about interop