You should reply to the list, not to me directly.

I did look at this, and there are problems with any solution that I tried. For example, first, I tried walking the text table anchor, but I repeatedly crashed LO when I tried that. I also found that performing a few sneaky things (such as looking at the anchor's text object and then creating a cursor at that text object failed when I had a cell that contained ONLY a text table (because creating a cursor in that cell did not leave any place for that cursor to be except for in the containing text table).

Next, I tried another sneaky thing such as simply disposing the text table and then checking to see if the view cursor was still in a text table. it looks like that approach may work, but I did not pursue it past a few very basic tests.

sub MainTable
  Dim oTable
  Dim oVC
  Dim sName$
  ovc = ThisComponent.getCurrentController().getViewCursor()
  Do While NOT IsNull (ovc.TextTable) AND NOT IsEmpty(ovc.TextTable)
    oTable = ovc.TextTable
    sName = oTable.Name
    oTable.dispose()
    'Print "removed " & sName
  Loop
End Sub


On 07/10/2011 11:25 AM, Shameera Rathnayaka wrote:
thanks Andrew,

this is the code in java its worked

  // get text view cursor from the text document
XController xController = xTextDocument.getCurrentController(); XTextViewCursorSupplier xCursorSup = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
            XTextViewCursor xViewCursor = xCursorSup.getViewCursor();
XPropertySet xCursorPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xViewCursor);
            Object tab = xCursorPropertySet.getPropertyValue("TextTable");
XTextTable table = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, tab);
            table.dispose();  // delete the table
and now i want to duplicate the complex table, complex table mean it has several tables inside it, even if the cursor inside the one of it's child table, i want to duplicate the full complex table. for this i want to select most outer table.
can anybody help me with this

*Thanks*

On Sun, Jul 10, 2011 at 7:28 PM, Andrew Douglas Pitonyak <and...@pitonyak.org <mailto:and...@pitonyak.org>> wrote:

    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
    <http://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




--
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

Reply via email to