15,893,487 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by VivianMC (Top 2 by date)
VivianMC
12-Nov-15 6:11am
View
I know the following is probably too late to help you, but I'd like to add how this can be done so that if someone stumbles upon your question he can resolve it.
The problem is that you cannot read DOCX file like you would read simple text files, this is because DOCX file is actually a zipped group of files and folders.
But there is an article here on CodeProject that shows you how you can retrieve DOCX file's text content as a string, see:
Find Text in Word Documents
Alternatively you can use
this C# component for word documents
, it can
process (read and write) DOCX files in C#
and you could easily get its content as string like the following:
DocumentModel document = DocumentModel.Load("Sample.docx");
string s = document.Content.ToString();
VivianMC
11-Nov-15 5:57am
View
See the following link, I believe it's exactly what you want:
https://code.msdn.microsoft.com/windowsapps/Word-Document-Editor-in-d97fd70b
In short it's a sample application for a word document editor. It also uses a RichTextBox control, but additionally it uses
this C# library for word documents
as well. Now how it works is that any document that you want to open is first converted into an RTF format, that library is able to
read your word files (both DOC and DOCX) in C#
and
write them in RTF formats with C#
. Also when you want to save the RichTextBox content into a file, the library will read that RTF content and
create the desired (for example PDF) file in C#
.