Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I have a one .docx file.Suppose if in .docx file there are only Three words "I AM MAYANK" so i want these 3 words in 3 lables.

Please reply
Posted
Updated 15-Feb-19 0:45am
Comments
Pankaj Chamria 3-Jan-12 8:27am    
You will need to use Microsoft Office Automation API to read the file.. There are plenty of links available on the web.. Here are a few -

http://www.programmerfish.com/quick-tutorial-how-to-read-microsoft-word-file-in-c/

http://www.codeproject.com/KB/office/ExtractTextFromDOCXs.aspx
[no name] 15-Nov-12 1:34am    
Hi,

Where are the labels in your document?

The location is important.

If you can use Interop, have a look at Document.Words Property [^]. That would list all the words found in a document as a collection.
 
Share this answer
 
Comments
Amir Mahfoozi 3-Jan-12 8:29am    
+5 good answer.
Wendelius 3-Jan-12 8:45am    
Thanks Amir :)
go through this CP article, this may helps you
Read Document Text Directly from Microsoft Word File[^]
Thanks
 
Share this answer
 
C#
string content = File.ReadAllText("one.docx");

var words = from word in content.Split(WhiteSpace, StringSplitOptions.RemoveEmptyEntries)

select word;
 
Share this answer
 
Comments
mayankshrivastava 4-Jan-12 4:51am    
it doesn't work!

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