List Info

Thread: Inserting an RTF stream




Inserting an RTF stream
user name
2007-02-05 02:33:24
Hello,

I'm trying to insert an RTF stream to a
"OpenOffice" instance running inside 
the "OOoBean". Here is the code for this.

XDocumentInsertable xDocInsertable = (XDocumentInsertable) 
UnoRuntime.queryInterface(XDocumentInsertable.class,
xTextCursor);

PropertyValue[] loadProps = new PropertyValue[1];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "FilterName";
loadProps[0].Value = "Rich Text Format";

loadProps[1] = new PropertyValue();
loadProps[1].Name = "InputStream";
loadProps[1].Value = new
ByteArrayToXInputStreamAdapter(data);

xDocInsertable.insertDocumentFromURL("private:stream&qu
ot;, loadProps);

But I always get an
"com.sun.star.lang.IllegalArgumentException" and
don't 
understand what's the problem. When I'm using the function 
XComponentLoader.loadComponentFromURL("private:stream&q
uot;, "_blank", 0, 
loadProps) instead of 
XDocumentInsertable.insertDocumentFromURL("private:stre
am", loadProps) 
everything works fine.

But the problem is I'd like to insert some RTF formatted
text in a running 
"OpenOffice" instance at the current position of
the cursor. So I think the 
function insertDocumentFromURL is the better choice, because
with this I can 
insert it at the current position of the cursor. So please
can someone help 
me trying to fix the problem.

Regards Markus 



------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Inserting an RTF stream
user name
2007-02-06 02:27:38
Markus Buch wrote:

> Hello,
> 
> I'm trying to insert an RTF stream to a
"OpenOffice" instance running inside 
> the "OOoBean". Here is the code for this.
> 
> XDocumentInsertable xDocInsertable =
(XDocumentInsertable) 
> UnoRuntime.queryInterface(XDocumentInsertable.class,
xTextCursor);
> 
> PropertyValue[] loadProps = new PropertyValue[1];
> loadProps[0] = new PropertyValue();
> loadProps[0].Name = "FilterName";
> loadProps[0].Value = "Rich Text Format";
> 
> loadProps[1] = new PropertyValue();
> loadProps[1].Name = "InputStream";
> loadProps[1].Value = new
ByteArrayToXInputStreamAdapter(data);
> 
>
xDocInsertable.insertDocumentFromURL("private:stream&qu
ot;, loadProps);
> 
> But I always get an
"com.sun.star.lang.IllegalArgumentException" and
don't 
> understand what's the problem. When I'm using the
function 
>
XComponentLoader.loadComponentFromURL("private:stream&q
uot;, "_blank", 0, 
> loadProps) instead of 
>
XDocumentInsertable.insertDocumentFromURL("private:stre
am", loadProps) 
> everything works fine.

The insertDocumentFromURL method does not support reading
from a stream.
IIRC there is already a filed issue for this (don't remember
the number,
sorry).

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
Please don't reply to "nospamformbagmx.de".
I use it for the OOo lists and only rarely read other mails
sent to it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )