C# .NET - How to Extract Text from Word Document ?

Asked By Nanda Kishore on 23-Mar-15 10:43 AM
I am trying to extract specific text from word document based on coordinates, i have been searching many sites on this requirement ,but no luck. How to set the coordinates to the word document text ?
 
if any one know about this, could you share the answer.
Robbe Morris replied to Nanda Kishore on 23-Mar-15 10:45 AM
Word documents don't have the concept of coordinates.  They are not images.  Use something like Aspose to safely open the word document and work with its object model to find the page you are after and then parse the text.
Renee Ginsberg replied to Nanda Kishore on 07-May-15 11:35 AM
Do you mean by coordinates the column and row number in the MS document file?
If yes, I searched internet and found the following thread that takes about a similar approach:
http://stackoverflow.com/questions/9181085/how-to-get-text-from-line-number-in-ms-word

But if you mean that you want to get text based on display coordinates (for example), One solution that I can suggest is to load the document as image, draw a region on it, crop it and then pass the cropped image to OCR engine. I know that leadtools has support for OCR and loading documents. You can find more information here:
http://www.codeproject.com/Articles/317163/OCR-with-LEADTOOLS-The-Better-Choice
alex smith replied to Nanda Kishore on 05-Jan-16 03:11 AM
Hi, as Robbe said there is no concept of coordinates in Word, you'd better convert Word document to PDF first and then extract text by coordinates. Therefore following links may help

Convert Word to PDF in C#
http://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/How-to-Convert-Word-to-PDF.html

Extract PDF text by coordinates

http://stackoverflow.com/questions/7405267/extract-pdf-text-by-coordinates