Hi, I use Doors RTF perms and extract a requirement with text, formatting and picture(not always a picture) . I attached this picture as a file under the post.
Is it between: \object\objemb{\*\objclass Paint.Picture}\objw495\objh480{\*\objdata
and if I copy these data how can I convert it to picture? 2 .Is it RLE decompressed , base64 or this is hexadecimal data? 3. How to convert it to picture ?
Dinio - Tue Feb 02 04:15:37 EST 2016 | ||
Re: Extract file from RTF. You can't (easily). If you look at the COM specification you might be able to get in depth about what is going on: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680573(v=vs.85).aspx Especially interesting should be the Guide about OLE Data Transfer and Storage: https://msdn.microsoft.com/en-us/library/windows/desktop/ms693383(v=vs.85).aspx OLE Objects are referred to as "Compound Documents" which need to implement a couple of interfaces to be able to be used as OLE Objects. One of it is the IStorage / IStream A container used to create compound documents must supply the IStorage interface, through which objects store and retrieve data. So for DOORS, the RichText edit component will supply an IStorage Interface to the COM objects and tells "write your data here". The OLE Objects themselves write their data as they like to. So in your case MS Paint will use its own proprietary format for storing the picture information. The same is true for Word, Excel, PDF, Powerpoint, etc. and of course the Packager. Still there is help. If you are interested in converting OLE data - there are a couple of open source projects that deal with this topic and contain example code. You might not want to deal with all of that from DXL, but maybe make another tool that reads the RTF and uses one of the existing libraries to convert the files from them. Regards, Mathias
| ||
Re: Extract file from RTF. By the way: In DOORS there is a simple perm to extract the preview picture from an OLE object (if you are only about pictures): exportPicture. This perm will use the OLE functions to get the preview picture part of the ole (in your file: {\result{\pict\wmetafile8 ...) and store it as a picture. Maybe this is all you need. Regards, Mathias
| ||
Re: Extract file from RTF. Mathias Mamsch - Tue Feb 02 06:26:50 EST 2016 You can't (easily). If you look at the COM specification you might be able to get in depth about what is going on: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680573(v=vs.85).aspx Especially interesting should be the Guide about OLE Data Transfer and Storage: https://msdn.microsoft.com/en-us/library/windows/desktop/ms693383(v=vs.85).aspx OLE Objects are referred to as "Compound Documents" which need to implement a couple of interfaces to be able to be used as OLE Objects. One of it is the IStorage / IStream A container used to create compound documents must supply the IStorage interface, through which objects store and retrieve data. So for DOORS, the RichText edit component will supply an IStorage Interface to the COM objects and tells "write your data here". The OLE Objects themselves write their data as they like to. So in your case MS Paint will use its own proprietary format for storing the picture information. The same is true for Word, Excel, PDF, Powerpoint, etc. and of course the Packager. Still there is help. If you are interested in converting OLE data - there are a couple of open source projects that deal with this topic and contain example code. You might not want to deal with all of that from DXL, but maybe make another tool that reads the RTF and uses one of the existing libraries to convert the files from them. Regards, Mathias
| ||
Re: Extract file from RTF. Dinio - Tue Feb 02 07:16:29 EST 2016
I don't know. I have not tried any yet, so I would need to google myself. Note that there are commercial libraries out there, which might be something you want to look at for a reliable DOORS service. Regards, Mathias | ||
Re: Extract file from RTF. Mathias Mamsch - Tue Feb 02 10:21:08 EST 2016 I don't know. I have not tried any yet, so I would need to google myself. Note that there are commercial libraries out there, which might be something you want to look at for a reliable DOORS service. Regards, Mathias I find only some like Tika, Apache POI which does not have rich functionality for extracting embedded files. That why I am asking. | ||
Re: Extract file from RTF. Dinio - Tue Feb 02 10:24:16 EST 2016 I find only some like Tika, Apache POI which does not have rich functionality for extracting embedded files. That why I am asking. Same for me: You find a lot of small projects like this: https://github.com/Sicos1977/OfficeExtractor http://www.codeproject.com/Tips/784558/Extract-Embedded-Files-from-Microsoft-Office-Docum http://blogmal.42.org/tidbits/ole-compound-file.story http://www.decalage.info/python/rtfobj http://www.pldaniels.com/ripole/ etc. I guess you need to pick one and start tweaking until it works - or go to a commercial library. Regards, Mathias | ||
Re: Extract file from RTF. Mathias Mamsch - Tue Feb 02 11:02:37 EST 2016 Same for me: You find a lot of small projects like this: https://github.com/Sicos1977/OfficeExtractor http://www.codeproject.com/Tips/784558/Extract-Embedded-Files-from-Microsoft-Office-Docum http://blogmal.42.org/tidbits/ole-compound-file.story http://www.decalage.info/python/rtfobj http://www.pldaniels.com/ripole/ etc. I guess you need to pick one and start tweaking until it works - or go to a commercial library. Regards, Mathias If there is a commercial library it will be OK but I can not find even such. | ||