annotation annotations insert annotation Matthias Prem How can I insert an annotation? /* InsertAnnotation.rex */ /* Macro */ /* get the script context, the XModel and the XTextDocument interface */ xScriptContext=uno.getScriptContext() oDoc=xScriptContext~getDocument xTextDoc=oDoc~{%see com.sun.star.text.XTextDocument%XTextDocument} xText=xTextDoc~getText() /* get the XMultiServiceFactory needed for textfields */ xServiceManager=oDoc~{%see com.sun.star.lang.XMultiServiceFactory%XMultiServiceFactory} /* create an annotation */ annotation=xServiceManager~createInstance("{%see com.sun.star.text.TextField.Annotation}") annotationTC=annotation~{%see com.sun.star.text.XTextContent%XTextContent}() /* set author and content of the annotation */ annotationPS=annotation~{%see com.sun.star.beans.XPropertySet%XPropertySet}() annotationPS~setPropertyValue("Author", "ooRexx") annotationPS~setPropertyValue("Content", "I was here.") /* insert annotation at cursor position */ xCursor=xTextDoc~getText~createTextCursor() xText~insertTextContent(xCursor, annotationTC, .false) ::requires UNO.CLS Initial version