Hi,
When removing annotations in a text document,we can query
the XTextFieldsSupplier and make access to the annotations
by XTextFieldsSupplier.getTextFields(). Anyway, what we get
are all the annotations in a document. We can not remove a
specific annotation in this way, as we do via the mouse. We
can select the one annotion we want to remove within a
piece of text by the mouse and delete the piece of text.
Thus the annotition will gone with the text. Can we do the
same( only without remove the text) with OOo API? I've
tried with quering XEnumerationAccess interface from
XModel.getCurrentSelection(), as shown in the following
code, but failed at the first place: the selection doesn't
seem to support XEnumerationAccess.Here's the code:
....
XEnumerationAccess xEAccess=(XEnumerationAccess)
UnoRuntime.queryInterface(XEnumerationAccess.class,
xModel.getCurrentSelection());
if (xEAccess.hasElements())System.out.println
("4444");
XEnumeration xEnumeration=
xEAccess.createEnumeration();
while(xEnumeration.hasMoreElements()){
Object oField= xEnumeration.nextElement();
XServiceInfo xInfo = (XServiceInfo)
UnoRuntime.queryInterface(
XServiceInfo.class, oField );
if ( xInfo.supportsService
( "com.sun.star.text.TextField.Annotation") )
{
XTextField oNote=
(com.sun.star.text.XTextField)UnoRuntime.queryInterface
(com.sun.star.text.XTextField.class, oField);
xText.removeTextContent(oNote);
}
}
....
Any idea? Thank you in advance!
Regards,
Yu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]