On 07/09/2011 01:52 AM, Shameera Rathnayaka wrote:
hi dev,
This is my problem i could delete all table in doc , but how can i
delete table in cursor position which i dont know the name and index
of that table.
I believe that the view cursor has a text table property that you can
check to see if the cursor is in a text table. This is how I do it in Basic
Dim oVC : oVC = ThisComponent.getCurrentController().getViewCursor()
If Not IsNull(oVC.TextTable) Then
Print "In TextTable " & oVC.TextTable.Name
End If
here my code to delete all table in textRange but it delete all table
in my doc, if you know please give me a help or point out some helpful
links
XTextTable table=null;
XText text = xTextDocument.getText();
XTextRange textRange= text.getStart();
XEnumerationAccess xParaAccess = (XEnumerationAccess)
UnoRuntime.queryInterface(XEnumerationAccess.class, textRange.getText());
XEnumeration xParaEnum = xParaAccess.createEnumeration();
while (xParaEnum.hasMoreElements()) {
try {
Object objElement = xParaEnum.nextElement();
XServiceInfo xInfo = (XServiceInfo)
UnoRuntime.queryInterface(XServiceInfo.class, objElement);
if
(xInfo.supportsService("com.sun.star.text.TextTable")) {
table = (XTextTable) UnoRuntime.queryInterface(
XTextTable.class,objElement);
table.dispose();
}
} catch (com.sun.star.container.NoSuchElementException ex) {
java.util.logging.Logger.getLogger(TableOparater.class.getName()).log(Level.SEVERE,
null, ex);
} catch (WrappedTargetException ex) {
java.util.logging.Logger.getLogger(TableOparater.class.getName()).log(Level.SEVERE,
null, ex);
}
}
*thanks *
--
Shameera Rathnayaka
Undergraduate
Department of Computer Science and Engineering
University of Moratuwa.
Sri Lanka.
T.P. 0719221454
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php
--
-----------------------------------------------------------------
To unsubscribe send email to dev-unsubscr...@openoffice.org
For additional commands send email to sy...@openoffice.org
with Subject: help