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: [EMAIL PROTECTED]
> 

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

Reply via email to