473,395 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

accessing to a word document in C++

I'm looking for a sample code in C++ that access to a Microsoft word document and read its content. Please guide me.
thanks in advance
Apr 29 '07 #1
2 3917
weaknessforcats
9,208 Expert Mod 8TB
Save the Word doc as plain text and read it as a text file.
Or, save it RTF(Rich Text Format) which is also a text file but with markups os the file can be ported to another word processor.
Apr 29 '07 #2
sibain
1
A little late sorry but I have just seen this post.

Hi just in case you have not found the answer work around the following.

Microsoft::Office::Interop::Word::ApplicationClass ^ word = gcnew Microsoft::Office::Interop::Word::ApplicationClass ();
Microsoft::Office::Interop::Word::Document^ doc = gcnew Microsoft::Office::Interop::Word::Document();

word->Application->Visible = false ; /* or true if you wish to see word */
Object^ oFile = (Object^)sFilename;
Object^ missing = System::Reflection::Missing::Value;
doc = word->Application->Documents->Open(oFile,
missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing);


You must add the MS Word Com object to your project. You can then change save or generally do most things from your app. Like save it to a proper format. :-)

Remember this is not ANSII C++ It is MS Managed C++

All the best

Simon
May 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can...
3
by: Adam Faulkner via DotNetMonster.com | last post by:
I want to create a method within a class that opens a Microsoft Word 2000 Document and has the facility to Create a new word document and then extract a Page that exists within the original Word...
1
by: Adam Faulkner via DotNetMonster.com | last post by:
I had a problem before extracting pages from an existing word document and then inserting the content into a new word document. The following code below works with Microsoft Word 2000 Function...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
0
southoz
by: southoz | last post by:
Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
1
by: =?Utf-8?B?Y3JhaWc=?= | last post by:
I am trying to insert text into a Word document and then apply a style to the paragraph I just wrote. My problem is that the range stays set to the entire document and I can't figure out how to...
8
by: babyangel43 | last post by:
Hello, I have a query set up in Access. I run it monthly, changing "date of test". I would like this query to be merged with a Word document so that the cover letter is created in Word, the fields...
1
by: captainwin | last post by:
Here's the problem: - Website is ASP.NET 1.0 - Server is Windows Server 2003 - Browser is IE 6/7 - Client requests a mail merged MS Word 97 - 2003 document on the website, and the document gets...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.