Delete table in cursor position
Shameera Rathnayaka <[email protected]> Sat, 9 Jul 2011 11:22:44 +0530
| Newsgroups | gmane.comp.openoffice.devel.general |
|---|---|
| Message-ID | <CAJvLytr7+U=4iWpr=6MPfkGSkiVM+qp+iLVm4Bs8UzqHSTMqQw@mail.gmail.com> |
--001636c9262b463b9704a79c902f
Content-Type: text/plain; charset=ISO-8859-1
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.
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
--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help
--001636c9262b463b9704a79c902f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
hi dev,<div><br></div><div>This is my problem i could delete all table in d=
oc , but how can i delete table in cursor position which i dont know the na=
me and index of that table.</div><div><br></div><div>here my code to delete=
all table in textRange but it delete all table in my doc, if you know plea=
se give me a help or point out some helpful links=A0</div>
<div><br></div><div><div>XTextTable table=3Dnull;</div><div>=A0 =A0 =A0 =A0=
XText text =3D xTextDocument.getText();</div><div>=A0 =A0 =A0 =A0 XTextRan=
ge textRange=3D text.getStart();</div><div><br></div><div>=A0 =A0 =A0 =A0 X=
EnumerationAccess xParaAccess =3D (XEnumerationAccess) UnoRuntime.queryInte=
rface(XEnumerationAccess.class, textRange.getText());</div>
<div>=A0 =A0 =A0 =A0 XEnumeration xParaEnum =3D xParaAccess.createEnumerati=
on();</div><div>=A0 =A0 =A0 =A0 while (xParaEnum.hasMoreElements()) {</div>=
<div>=A0 =A0 =A0 =A0 =A0 =A0 try {</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 Object objElement =3D xParaEnum.nextElement();</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 XServiceInfo xInfo =3D (XServiceInfo) =
UnoRuntime.queryInterface(XServiceInfo.class, objElement);</div><div>=A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 if (xInfo.supportsService("com.sun.star.te=
xt.TextTable")) {</div><div>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 table =3D (XTextTable) UnoRuntime.q=
ueryInterface(</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0XTe=
xtTable.class,objElement);</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 table.dispose();</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }</div><div>=
=A0 =A0 =A0 =A0 =A0 =A0 } catch (com.sun.star.container.NoSuchElementExcept=
ion ex) {</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 java.util.logging.Logger.getLogger(Tab=
leOparater.class.getName()).log(Level.SEVERE, null, ex);</div><div>=A0 =A0 =
=A0 =A0 =A0 =A0 } catch (WrappedTargetException ex) {</div><div>=A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 java.util.logging.Logger.getLogger(TableOparater.class=
.getName()).log(Level.SEVERE, null, ex);</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 }</div><div>=A0 =A0 }</div><div><br></div><b>t=
hanks=A0</b><br>-- <br><span style=3D"font-family:comic sans ms,sans-serif"=
>Shameera Rathnayaka</span><br style=3D"font-family:comic sans ms,sans-seri=
f"><span style=3D"font-family:comic sans ms,sans-serif">Undergraduate</span=
><br style=3D"font-family:comic sans ms,sans-serif">
<span style=3D"font-family:comic sans ms,sans-serif">Department of Computer=
Science and Engineering</span><br style=3D"font-family:comic sans ms,sans-=
serif"><span style=3D"font-family:comic sans ms,sans-serif">University of M=
oratuwa.</span><br style=3D"font-family:comic sans ms,sans-serif">
<span style=3D"font-family:comic sans ms,sans-serif">Sri Lanka.</span><br s=
tyle=3D"font-family:comic sans ms,sans-serif"><span style=3D"font-family:co=
mic sans ms,sans-serif">T.P.=A0 0719221454</span><br>
</div>
--001636c9262b463b9704a79c902f--