Thank you for your explaination! Now I get an idea of storing a file clearly.:-)
----- Original Message ----- From:Mathias Bauer To:dev@openoffice.org Subject:Re: [dev] RE:Re: [dev] RE:[dev] question about use XStorage in filter Date:07-06-25 14:55:37 Hi, first thanks for fixing the problem with the mail client. Now about the possible problem. [EMAIL PROTECTED] wrote: > ///create the target storage > > uno::Sequence aArgs( 2 ); > aArgs[0] aArgs[1] uno::Reference xTargetStorage( > xStorageFactory->createInstanceWithArguments( aArgs ), > uno::UNO_QUERY ); The problem is that you shouldn't use the URL, you must use the outputstream that is provided to you. The framework opens a temporary stream and finally copies it over the target file in the Commit() in SfxObjectShell that you have quoted. The reason is simple: if something goes wrong in the filter the original files isn't destroyed. So even if you already create your file at the target location the SfxObjectShell will overwrite it with all the content stored in the output stream. In your case the stream is empty, thus the zero byte length of the result. Here's what a filter creating a storage should do: - first create a temporary file - get the XStream interface from it - open a storage based on that stream - copy the document into it - add your substorage - commit this storage(!) - dispose of it - copy from this stream to the XOutputStream from the arguments - dispose of the TempFile The content of the output stream is handled by the framework code. It will close the stream and copy the bits if everything went fine. Seeing your code I wonder whether we should add a "Stream" argument so that you don't need to create the temporary copy. But for the time being you should proceed as recommended. Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[EMAIL PROTECTED]". I use it for the OOo lists and only rarely read other mails sent to it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ------------------------------------------------------------------- MOTO新摄会 狂拍无极限 超多好礼等你来赢( http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2007/mail_zhuiyu_20070625.html ) =================================================================== 注册新浪2G免费邮箱( http://mail.sina.com.cn/chooseMode.html )