Ask Your Question
1

With BASIC how do you select the next table? [closed]

asked 2013-02-11 16:16:43 +0200

Kevin.kd gravatar image

updated 2013-02-11 16:17:43 +0200

I am very new to using the BASIC macros in Libre Office.

I am using a template doc with text and pre-defined tables.

I can insert text where I want with Cursor.gotoNextParagraph(False), Cursor.gotoEndOfSentence(False) etc.

My difficulties are with tables, how do you select the next table?

Cell = Table.getCellByName("B2") Cell.String = " Some Text "

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-24 02:51:20.882334

2 Answers

Sort by » oldest newest most voted
1

answered 2013-02-11 17:26:51 +0200

JohnSUN gravatar image

updated 2013-02-12 08:05:24 +0200

Many interesting methods of work with text tables can be found in this book by Andrew Pitonyak

Sub workWithTextTables
Dim oDoc As Variant
Dim oTextTables As Variant
Dim oTable As Variant
Dim oCell As Variant
Dim i&
    oDoc = ThisComponent
    oTextTables = oDoc.getTextTables()
    For i = 0 To oTextTables.getCount()
        oTable = oTextTables.getByIndex(i)
           ... do something ...
    Next i
REM // or by name
    oTable = oTextTables.getByName("tbl_1")
oTable = oTextTables.getByName("tbl_2")
oTable = oTextTables.getByName("myNextTable") etc...
REM // get cell by Column/nRow
    oCell = oTable.getCellByPosition(0, 1)
REM // or by name
    oCell = oTable.getCellByName("A2")
    oCell.setString(" Some Text ")
End Sub
edit flag offensive delete link more
0

answered 2013-02-26 08:36:55 +0200

Kevin.kd gravatar image

Thanks for that.

Will be studying it over the next few days.

edit flag offensive delete link more

Comments

Hi @Kevin.kd -- Did @JohnSUN's answer help you out? If it solved your problem, please mark it as correct. If you still have additional questions on this topic, please let us know so we can help you further.

Thanks!

qubit gravatar imagequbit ( 2013-03-19 05:14:52 +0200 )edit

Question Tools

Stats

Asked: 2013-02-11 16:16:43 +0200

Seen: 1,295 times

Last updated: Feb 26 '13