Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have word document with data.I want get value from word document data as
"Cost : 50.00".In that I passing cost as input and get 50 using word interop.

What I have tried:

I try with matching word,but I didn't get exact result or get entire line with text contain
Posted
Updated 1-Jan-17 9:10am
Comments
Ralf Meier 30-Dec-16 3:27am    
There are a lot of examples to be found with Google if you ask a question like this.
So ... what have you tried until now ?
You should improve your question with your actual code ...
Afzaal Ahmad Zeeshan 1-Jan-17 6:37am    
What exactly did you get and what code did you try to use?

Here's some knowledge for you:

Normal .doc, .docx are saved in what can be overall considered binary - i.e., the text and markup that make it a word document are similar to as if they were in a program.

You can make your life easier by saving the documents as XML (see the option in the save-as) listing. In this case, at least it's all in plain-text. HOWEVER, you words and even characters may not be in a single block. This will depend upon formatting. It will also depend on whether the data has been modified in Word, as this, itself, will often wrap the changed text in its own markup.

But - if you look at the XML in a binary editor you can see how your particular text is wrapped, extract that block, and finally clean it up to get what you want.

One last note: if you (you users) open the document as .XML, it will save as .XML unless they change it back.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900