OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

insertDocumentFromURL and private:stream

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
sebastians
Newbie
Newbie


Joined: 28 Dec 2005
Posts: 1

PostPosted: Wed Dec 28, 2005 2:40 pm    Post subject: insertDocumentFromURL and private:stream Reply with quote

It is posiible to use "private:stream" as url parameter for XDocumentInsertable.insertDocumentFromURL ?
Back to top
View user's profile Send private message
n0mer
General User
General User


Joined: 20 Mar 2006
Posts: 46

PostPosted: Mon Jun 26, 2006 6:58 am    Post subject: Re: insertDocumentFromURL and private:stream Reply with quote

sebastians wrote:
It is posiible to use "private:stream" as url parameter for XDocumentInsertable.insertDocumentFromURL ?


Why not?
http://api.openoffice.org/docs/DevelopersGuide/Text/Text.xhtml#1_3_1_5_Inserting_Text_Files
Quote:

Inserting Text Files

The text cursor in writer supports the interface com.sun.star.document.XDocumentInsertable which has a single method to insert a file at the current cursor position:

void insertDocumentFromURL( [in] string aURL,
[in] sequence< com::sun::star::beans::PropertyValue > aOptions)

Pass a URL and an empty sequence of PropertyValue structs. However, load properties could be used as described in com.sun.star.document.MediaDescriptor.


MediaDescriptor supports loading document content from InputStream:
http://api.openoffice.org/docs/common/ref/com/sun/star/document/MediaDescriptor.html
Quote:

::com::sun::star::io::XInputStream
InputStream [ OPTIONAL ]
content of document
Back to top
View user's profile Send private message Visit poster's website
n0mer
General User
General User


Joined: 20 Mar 2006
Posts: 46

PostPosted: Mon Jun 26, 2006 9:46 am    Post subject: Re: insertDocumentFromURL and private:stream Reply with quote

sebastians wrote:
It is posiible to use "private:stream" as url parameter for XDocumentInsertable.insertDocumentFromURL ?


But...i got IllegalArgumentException with the following code
(hidden parameter is removed as it suggested here: http://www.oooforum.org/forum/viewtopic.phtml?p=77866#77866 ) :
Code:

        PropertyValue[] loadProps = new PropertyValue[] {
//            makeProperty("Hidden",  Boolean.TRUE),
            makeProperty("FilterName",  "HTML (StarWriter)"), //writer_web_HTML_help
            makeProperty("InputStream", new OOInputStream(html.getBytes()))
        };
        xDocumentInsertable.insertDocumentFromURL("private:stream", loadProps);


No visible way to find sources for Java implementation of XDocumentInsertable class
to debug them: i downloaded OOo_2.0.2_src.tar.gz (293M), but there are no sources.
Only these files:
Quote:

./OOB680_m5/qadevOOo/testdocs/XDocumentInsertable.sxw
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/CVS
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/CVS/Template
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/CVS/Entries
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/CVS/Tag
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/CVS/Root
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/CVS/Repository
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/script.xlb
./OOB680_m5/qadevOOo/tests/basic/ifc/document/XDocumentInsertable/document_XDocumentInsertable.xba
./OOB680_m5/qadevOOo/tests/java/ifc/document/_XDocumentInsertable.java
./OOB680_m5/offapi/com/sun/star/document/XDocumentInsertable.idl
./OOB680_m5/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw

Back to top
View user's profile Send private message Visit poster's website
n0mer
General User
General User


Joined: 20 Mar 2006
Posts: 46

PostPosted: Mon Jun 26, 2006 11:57 pm    Post subject: Re: insertDocumentFromURL and private:stream Reply with quote

n0mer wrote:
IllegalArgumentException with the following code
(hidden parameter is removed as it suggested here: http://www.oooforum.org/forum/viewtopic.phtml?p=77866#77866 ) :
Code:

        PropertyValue[] loadProps = new PropertyValue[] {
//            makeProperty("Hidden",  Boolean.TRUE),
            makeProperty("FilterName",  "HTML (StarWriter)"), //writer_web_HTML_help
            makeProperty("InputStream", new OOInputStream(html.getBytes()))
        };
        xDocumentInsertable.insertDocumentFromURL("private:stream", loadProps);



It seems possible load document from stream first,
then insert it via API.
Here ( http://www.oooforum.org/forum/viewtopic.phtml?p=15281#15281 ) is java source code for iteration over text paragraphs in Writer document, followed with well-argumented discussion.

And, still unable to find the way how to debug source code of insertDocumentFromURL() method Smile


Last edited by n0mer on Tue Jun 27, 2006 7:34 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
n0mer
General User
General User


Joined: 20 Mar 2006
Posts: 46

PostPosted: Tue Jun 27, 2006 7:02 am    Post subject: Reply with quote

For cross-reference: http://www.oooforum.org/forum/viewtopic.phtml?t=6821
("Text copying")
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group