Connecting Tech Pros Worldwide Forums | Help | Site Map

Read Office Files from C++.

miztaken
Guest
 
Posts: n/a
#1: Jun 27 '08
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



Victor Bazarov
Guest
 
Posts: n/a
#2: Jun 27 '08

re: Read Office Files from C++.


miztaken wrote:
Quote:
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
Pascal J. Bourguignon
Guest
 
Posts: n/a
#3: Jun 27 '08

re: Read Office Files from C++.


Victor Bazarov <v.Abazarov@comAcast.netwrites:
Quote:
miztaken wrote:
Quote:
>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__
Victor Bazarov
Guest
 
Posts: n/a
#4: Jun 27 '08

re: Read Office Files from C++.


Pascal J. Bourguignon wrote:
Quote:
Victor Bazarov <v.Abazarov@comAcast.netwrites:
>
Quote:
>miztaken wrote:
Quote:
>>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
miztaken
Guest
 
Posts: n/a
#5: Jun 27 '08

re: Read Office Files from C++.


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
Victor Bazarov
Guest
 
Posts: n/a
#6: Jun 27 '08

re: Read Office Files from C++.


miztaken wrote:
Quote:
So how do i start..?
You start by finding *a better venue* for this line of questions.
Quote:
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.
Quote:
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
miztaken
Guest
 
Posts: n/a
#7: Jun 27 '08

re: Read Office Files from C++.


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.
Victor Bazarov
Guest
 
Posts: n/a
#8: Jun 27 '08

re: Read Office Files from C++.


miztaken wrote:
Quote:
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
miztaken
Guest
 
Posts: n/a
#9: Jun 27 '08

re: Read Office Files from C++.


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 ?


ManicQin
Guest
 
Posts: n/a
#10: Jun 27 '08

re: Read Office Files from C++.


On May 20, 6:15 am, miztaken <justjunkt...@gmail.comwrote:
Quote:
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.
Frank Birbacher
Guest
 
Posts: n/a
#11: Jun 27 '08

re: Read Office Files from C++.


Hi!

Pascal J. Bourguignon schrieb:
Quote:
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
miztaken
Guest
 
Posts: n/a
#12: Jun 27 '08

re: Read Office Files from C++.


Hi ManicQin,
Thanks for the info.





Jim Langston
Guest
 
Posts: n/a
#13: Jun 27 '08

re: Read Office Files from C++.


miztaken wrote:
Quote:
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.
Quote:
You help is greatly appreciated.
>
Thank You


--
Jim Langston
tazmaster@rocketmail.com


Closed Thread