470,874 Members | 1,789 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,874 developers. It's quick & easy.

Read Office Files from C++.

Hi there,
I want to read my Office Files (DOC,XLS and PPT) files using ole32.dll
and C++ or C++.NEt.
I have googled a bit and found that i can read the contents of DOC
file by using Stogare and Stream, or let me say ole32.dll.
But i dont know how to read other things like embedded attachments.
Actually i want to dump all the embedded attachments of DOC file to my
hard drive for further processing.

So can any one please help me get the info i need.
I am unable to find any tutorial or references to ole32.dll and how to
use it to extract embedded attachments from DOC file.
Please help me, i would be very much grateful.
Thank you
miztaken
Jun 27 '08 #1
12 2170
miztaken wrote:
I want to read my Office Files (DOC,XLS and PPT) files using ole32.dll
and C++ or C++.NEt.
[..]
So can any one please help me get the info i need.
[..]
What you need is to post to the right newsgroup. Please look for any
newsgroup with .ole. in its name, preferably also with 'microsoft' in
it. Your problem has really nothing to do with the C++ *language* and
everything to do with the way Microsoft organizes its document files.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
Victor Bazarov <v.********@comAcast.netwrites:
miztaken wrote:
>I want to read my Office Files (DOC,XLS and PPT) files using ole32.dll
and C++ or C++.NEt.
[..]
So can any one please help me get the info i need.
[..]

What you need is to post to the right newsgroup. Please look for any
newsgroup with .ole. in its name, preferably also with 'microsoft' in
it. Your problem has really nothing to do with the C++ *language* and
everything to do with the way Microsoft organizes its document files.
Well, clc++ is ok.
Just start with:

#include <fstream>

ifstream officeFile;
officeFile.open("test.doc",ifstream::in);
while(officeFile.good()){
doSomethingWithNextMSWordByte(officeFile.get());
}
officeFile.close();
Then we could discuss how we could represent with C++ classes a
structured document, etc..

--
__Pascal Bourguignon__
Jun 27 '08 #3
Pascal J. Bourguignon wrote:
Victor Bazarov <v.********@comAcast.netwrites:
>miztaken wrote:
>>I want to read my Office Files (DOC,XLS and PPT) files using ole32.dll
and C++ or C++.NEt.
[..]
So can any one please help me get the info i need.
[..]
What you need is to post to the right newsgroup. Please look for any
newsgroup with .ole. in its name, preferably also with 'microsoft' in
it. Your problem has really nothing to do with the C++ *language* and
everything to do with the way Microsoft organizes its document files.

Well, clc++ is ok.
Just start with:

#include <fstream>

ifstream officeFile;
officeFile.open("test.doc",ifstream::in);
while(officeFile.good()){
doSomethingWithNextMSWordByte(officeFile.get());
}
officeFile.close();
Then we could discuss how we could represent with C++ classes a
structured document, etc..
I believe the OP was trying to reuse what MS has already implemented for
reading their own files. Most likely there are APIs for accessing parts
of the MS Office-specific formats. (not to doubt that it's all possible
to do in plain C++ if the format layout is known and available)

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #4
So how do i start..?
If any one can provide me the structure definition of DOC file (office
file).
I am able to get content of DOC file using IStream and IStorage
objects of ole32.dll.
But when parsing there are different object types and i dont know
their offsets.
So can anyone guide me on this?

You help is greatly appreciated.

Thank You
Jun 27 '08 #5
miztaken wrote:
So how do i start..?
You start by finding *a better venue* for this line of questions.
If any one can provide me the structure definition of DOC file (office
file).
MS Office has no relation to C++ *language*. Any third-party technology
discussion is basically off-topic here. Even if somebody knows the
structure of a DOC (or any other MS Office-specific) file, proceeding
with providing it here would go against the rules of this newsgroup.
I am able to get content of DOC file using IStream and IStorage
objects of ole32.dll.
But when parsing there are different object types and i dont know
their offsets.
So can anyone guide me on this?
OK, I'll repeat myself. Yes, somebody in the newsgroup relevant to
programming MS Office applications should be able to. Take a close look
at the 'microsoft.public.*' hierarchy.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #6
actually i have posted there as well and the group seem to have very
less activity as it may occur to me.
Thanks anyways for your suggestion.
Jun 27 '08 #7
miztaken wrote:
actually i have posted there as well and the group seem to have very
less activity as it may occur to me.
<rantish>
What if you need a recipe for a peach cobbler and the place where you
think you should be able to find it, is deserted (pun intended)? Do you
come to the electricians' newsgroup to see if anyone who has some
experience installing electrical ovens can help you?

Here is a story for you:

One cloudy night there was this man, standing on all four, feeling the
pavement with his hands, apparently looking for something on the ground
under a bright street light. Another man stops and asks, have you lost
something? Oh... My car key, I just dropped it, says the first man. So
the other man joins in and also starts looking around, trying to locate
the key. After a couple of minutes the second man asks the first one,
where exactly were you standing when you dropped the key? Over there,
says the first man and waves his arm towards the gates at the dark end
of the street about a hundred feet away. Then why are you looking here,
for crying out loud? Well, *here* I can actually *see*!
</rantish>

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #8
ok..
here is the things

1. Before i knew this wasnt the group for my question, i already had
posted my question and after that i posted on few more as well.
So where does those electrical oven fit here.

2. and about the light thing.
Since we can use ole32.dll through C++ this makes totally sensible for
me to hope if someone has done this before and if they have used it
then its not related to Office files any more but related to compound
files.

What do u think ?
Jun 27 '08 #9
On May 20, 6:15 am, miztaken <justjunkt...@gmail.comwrote:
ok..
here is the things

1. Before i knew this wasnt the group for my question, i already had
posted my question and after that i posted on few more as well.
So where does those electrical oven fit here.

2. and about the light thing.
Since we can use ole32.dll through C++ this makes totally sensible for
me to hope if someone has done this before and if they have used it
then its not related to Office files any more but related to compound
files.

What do u think ?
Miztaken Mon Ami dont bark at Moderators, they bite back. ;) (No
offence Victor)
You can debate on the relevance of your post as much as you want.
But it wont help you, as Victor said this is C++ *language* group.
(half of the people here dont even know what is office :) )
Feel free to post Qs about the standard, Design issues, UB & etc...
even though it seems it's a "narrow region of intrest" the group's
hands are always full.

try:
comp . os . ms-windows . programmer . win32
http://groups.google.com/group/comp....2/topics?hl=en
search codeproject.com or even msdn (my favourite for this kind of Qs
is vintage 10/01 and not the recents)
or try e-mailing that nice Stefan Ram.

in conclusion: if you keep with this post you will get a inadequate
answers and a lot of ranting.
Jun 27 '08 #10
Hi!

Pascal J. Bourguignon schrieb:
Just start with:

#include <fstream>

ifstream officeFile;
officeFile.open("test.doc",ifstream::in);
while(officeFile.good()){
doSomethingWithNextMSWordByte(officeFile.get());
}
officeFile.close();
Which is actually a bad example, because .good() will not indicate that
..get() will succeed on the next call. But if
doSomethingWithNextMSWordByte can cope with the EOF value, everything is
fine, I think.

Regards, Frank
Jun 27 '08 #11
Hi ManicQin,
Thanks for the info.

Jun 27 '08 #12
miztaken wrote:
So how do i start..?
If any one can provide me the structure definition of DOC file (office
file).
I am able to get content of DOC file using IStream and IStorage
objects of ole32.dll.
But when parsing there are different object types and i dont know
their offsets.
So can anyone guide me on this?
This is OT here, and you should be directed to microsoft.* but I will give a
pointer because in microsoft.* you will be directed to microsoft specific
solutions.

Look at openoffice. It's opensource, freely downloadable, will open office
documents (.doc, .xls, etc..) I'm not sure if they tie into ole or not, but
you can check them out. If you don't get an answer there,
microsoft.public.vc.language would be the way to go for the microsoft
specific answers.
You help is greatly appreciated.

Thank You


--
Jim Langston
ta*******@rocketmail.com
Jun 27 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Joerg Battermann | last post: by
6 posts views Thread by Anand | last post: by
1 post views Thread by =?Utf-8?B?QmFkaXM=?= | last post: by
3 posts views Thread by evenlater | last post: by
3 posts views Thread by Chuck | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.