Hi,
I was trying to insert an annotation at the current cursor
place. As XTextViewCursor is also a XTextRange, so I
inserted an annotation with the following code:
...
XTextViewCursorSupplier xTVCS=
(XTextViewCursorSupplier)UnoRuntime.queryInterface
(XTextViewCursorSupplier.class, myDoc.getCurrentController
());
XTextViewCursor xTextCursor= (XTextViewCursor)
xTVCS.getViewCursor();
if(xTextCursor==null)System.out.println
("xTextCursor null");
try {
Object aField= cMSF.createInstance
("com.sun.star.text.TextField.Annotation");
if (aField==null)System.out.println("aField");
XPropertySet pSet= (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, aField);
pSet.setPropertyValue("Author", "Liao");
pSet.setPropertyValue("Content", "222222");
com.sun.star.text.XTextField aNote=
(com.sun.star.text.XTextField)UnoRuntime.queryInterface
(com.sun.star.text.XTextField.class, aField);
if (aNote==null)System.out.println("222");
xText.insertTextContent(xTextCursor, aNote,
false);
}
catch(com.sun.star.uno.Exception e){
System.out.println("111");
}
However, the text document crashed down on execution. Could
anyone tell me what is wrong? And BTW, how can I insert the
annotation at the cursor place? Thank you!
Regards,
Yu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]