0

I'm getting text from whole pages of doc file in c# using microsoft.office.interop.word reference library:

string docPath = Server.MapPath("~/images/profile/" + pic);
Application app = new Application();
Document doc = app.Documents.Open(docPath);
string words = doc.Content.Text;

But how can I get text per page from doc file?

croxy
  • 4,082
  • 9
  • 28
  • 46
  • have you tried [this](http://stackoverflow.com/questions/28987095/get-pages-of-word-document)? or I am getting it wrong? – Ioana Stoian Nov 14 '16 at 07:52
  • yehh... but i got the null value in start object when the line " Start = WordApplication.Selection.GoTo(ref What, ref Which, ref CurrentPageNumber, ref Miss).Start;" was executed. – victor bijoy Nov 14 '16 at 07:56
  • Refer http://shaunakelly.com/word/word-development/selecting-or-referring-to-a-page-in-the-word-object-model.html. As per it, its not always possible to get text as per page. Do you really want to work as pages or sections. If its sections, I can share the code I have. – Mukul Varshney Nov 14 '16 at 08:25
  • thnx for the reference link. I didn't know that :) – victor bijoy Nov 22 '16 at 07:48

0 Answers0