tag:blogger.com,1999:blog-5280710301280348838.post1256709686409905697..comments2023-09-05T06:19:29.538-07:00Comments on Developers 42: Ole and accessing files embedded in Access part #2Jonathan van de Veenhttp://www.blogger.com/profile/15269789903353187250noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-5280710301280348838.post-32942168034356717092020-08-15T13:58:25.312-07:002020-08-15T13:58:25.312-07:00Hi,
Firstly, thank you for the article it has bee...Hi,<br /><br />Firstly, thank you for the article it has been a lifesaver as I have not been able to find much information on how to extract files embedded with OLE.<br />It's working great for older word documents however I can't seem to get it to work with the .docm format, word thinks the file is corrupt. <br />I know it's a longshot as this is a very old post but do you have any ideas why it wouldn't work for .docm? Any help at all would be greatly appreciated.<br /><br />Thanks<br />JamieJamiehttps://www.blogger.com/profile/03531540351098443178noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-76100222148046741572009-08-10T23:49:00.605-07:002009-08-10T23:49:00.605-07:00Hi there,
The short answer: You need the complete...Hi there,<br /><br />The short answer: You need the complete package object. It starts with Hex values 15 1C. What is does is getting you the actual content stream.<br /><br />To get a better understanding of this, have a look at part one of this article: <a href="http://jvdveen.blogspot.com/2009/01/ole-and-accessing-files-embedded-in.html" rel="nofollow">here</a>.<br /><br />It describes what headers are actualy handled by the OleStripper class.<br />If you have questions after that, please let me know. I'm always happy to help.<br /><br />Greets,<br />JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-50738066590600146002009-08-10T10:07:52.850-07:002009-08-10T10:07:52.850-07:00Great article, Jonathan, thanks for posting. I'...Great article, Jonathan, thanks for posting. I'm working on implementing a process that extracts embedded objects from Excel, Word & PowerPoint. Do you know if this code should also work on those as well? The program that I created is already working very well for the most part, with a few loose ends yet to tie up. I can extract most files just fine, but the 'MSPhotoEd' file type is giving me some headaches. I believe it is because I am not finding the correct point where the header ends and the file content begins, so I'm looking to the header parsing routine to get the info that I am missing. So far my attempts have not been successful as the headers that I have processed do not seem to follow the same pattern. If given the streams '\0Ole', '\0CompObj', 'CONTENTS' & 'CONTENTSV30', can you clarify which stream is represented by '_input' in your ReadHeader routine? Or if by chance I should be using some other stream or binary content? Any help is appreciated. Thanks.The Visitorhttps://www.blogger.com/profile/11761588905454152779noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-58471980933265235512009-07-06T01:44:15.692-07:002009-07-06T01:44:15.692-07:00Hi Gareth,
I would expect that the ClipArt type y...Hi Gareth,<br /><br />I would expect that the ClipArt type your using has a different header length from the PhotoEd type. You'd have to figure out the length needed. After that all that remains is to add the type to the GetStrippedStream method, in the same way the PhotoEd type is handled there.<br /><br />So where it now checks for the PhotoEd type, there should be another if to check for the ClipArt type. If it is the ClipArt type, do a seek from the current point to the _dataLength + the header size for a ClipArt file.<br /><br />I hope that helps you. If you figure it out, or if you need more help, please let us know.<br /><br />Greets,<br />JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-29858444164580246102009-07-06T01:33:24.515-07:002009-07-06T01:33:24.515-07:00Hi Jonathan
I have tried to use your code to extr...Hi Jonathan<br /><br />I have tried to use your code to extract jpeg data from an access database, with no success yet. Everything runs but the browser just renders the red X! The original ole objects seem to be of type MS_ClipArt_Gallery.5. Whereas your code seems to cater for MSPhotoEd.3 objects. Any clues as to how to customise your code to work for MS_ClipArt_Gallery.5 objects?<br /><br />Many thanks<br />GarethGareth Frowhttps://www.blogger.com/profile/04684729039584233384noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-849217221611603162009-03-03T02:33:00.000-08:002009-03-03T02:33:00.000-08:00Hi domasch,Your welcome. Unfortunately for you thi...Hi domasch,<BR/><BR/>Your welcome. Unfortunately for you this is complicated. If you don't have a Structured Storage then the OLE object doesn't contain filename information. <BR/><BR/>Maybe the file data itself contains this information, but you would have to handle each file on it's own and this would be well beyond the scope of this article.<BR/><BR/>If you do have a Structured Storage, you might find something in the StatStg class, but I'm not sure a filename is available there either.<BR/><BR/>For our implementation this is no issue as we store the original filename in a field next to the file.<BR/><BR/>Hope this helped you.<BR/><BR/>Greets,<BR/>JonathanJonathan van de Veenhttps://www.blogger.com/profile/15269789903353187250noreply@blogger.comtag:blogger.com,1999:blog-5280710301280348838.post-59170170466065889042009-03-03T02:15:00.000-08:002009-03-03T02:15:00.000-08:00many thx for your solution I was looking since las...many thx for your solution I was looking since last week. but two things I'm still looking for. how can I retrieve the filename and the fileextension of the saved OLE-object?Unknownhttps://www.blogger.com/profile/03195901639998060996noreply@blogger.com