Hi,

it seems to be a documentation problem.
In IDL it is "com.sun.star.textfield.Annotation" but in real life you
have to use "com.sun.star.text.TextField.Annotation".
That is of course a bug and we will clean up the IDL as well as the
implementation for a future version (probably not OO 2.0). For
compatibility reasons we will support ...text.textfield,
...text.TextField, ...text.fieldmaster and ...text.FieldMaster.

issue 50350

Juergen


Liao Yu wrote:
> I got the XMultiServiceFactory of the text document with:
>         XMultiServiceFactory cMSF= (XMultiServiceFactory)
> UnoRuntime.queryInterface(XMultiServiceFactory.class, 
> myDoc);
> where myDoc is a XTextDocument. But this did not make any 
> difference. It seems that things go wrong at 
> xMSF.createInstance
> ("com.sun.star.text.textfield.Annotation"), where a 
> com.sun.star.uno.Exception is caught. Any idea? Thank you 
> in advance!
> 
> Regards,
> 
> Yu
> 
> ----------------------原邮件-------------------
> Hi,
> 
> which service factory do you use? Is xMSF the global 
> service factory or
> the text document factory. Not all services can be 
> instantiated at the
> global service factory (service manager). Query your text 
> document
> object for XMultiServiceFactory and use this interface to 
> create the
> text field.
> 
> Juergen
> 
> Liao Yu wrote:
> 
>>Here is the code that I wrote to insert an annotation, 
>>referring to the example in section 7.3.5 of Developer's 
>>Guide:
>>...
>>        try {
>>            com.sun.star.text.XTextField aNote= 
>>(com.sun.star.text.XTextField)UnoRuntime.queryInterface
>>(XTextField.class, xMSF.createInstance
>>("com.sun.star.text.textfield.Annotation"));
>>            xText.insertTextContent(xText.getEnd(),  
>>aNote,  true);
>>            
>>        }
>>        catch(com.sun.star.uno.Exception e){
>>        System.out.println("111");
>>        }
>>...
>>However, what I get is no more than the 
>>com.sun.star.uno.Exception that createInstance() throws. 
>>Could anyone please tell me what's going wrong with that 
>>piece of code? Thank you!
>>
>>Regards,
>>
>>Yu
>>
>>----------------------------------------------------------
> 
> -----------
> 
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: dev-
> 
> [EMAIL PROTECTED]
> 
> 
> ------------------------------------------------------------
> ---------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to