Malte von der Lancken-Wakenitz wrote:

> Thanks for your prompt reply.
> 
>> Yes. Create the model as a service and either initialize or load it. In
>> Basic code:
>>
>> model = createUNOService("com.sun.star.text.TextDocument")
>> model.initNew()
>>
>> will create a new empty text document.
>>
>> dim mediadescriptor(n) as new com.sun.star.beans.PropertyValue
>> ' fill mediadescriptor
>> model = createUNOService("com.sun.star.text.TextDocument")
>> model.load( mediadescriptor )
>>
>> will create and load a document from what you put into the
>> mediadescriptor. Of course in this case you don't have a type detection
>> and you must either put the filter name into the mediadescriptor or
>> manually call the type detection service (not a big deal).
>>
> 
> I did not get very far with that. I am writing in java and tried this:
>   com.sun.star.text.XTextDocument xm = (com.sun.star.text.XTextDocument)
>  queryInterface(com.sun.star.text.XTextDocument.class,
> getMultiServiceFactory().createInstanceWithArguments("com.sun.star.text.TextDocument",
> args));
>           
> //(com.sun.star.text.XTextDocument)queryInterface(com.sun.star.text.XTextDocument.class,
> "com.sun.star.text.TextDocument");
>       xm.attachResource(surl, args);

The last statement doesn't do anything useful and perhaps even will
throw an exception because the document hasn't been initialized properly.

Why don't you try what I recommended:

com.sun.star.frame.XLoadable xm =
    (com.sun.star.frame.XLoadable)
    queryInterface( com.sun.star.frame.XLoadable.class,
    xFact.createInstance("com.sun.star.text.TextDocument"));
xm.initNew();

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to