[Solved] Acquiring the Data in tablegrid and loop it

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ouchd'greyt
Posts: 28
Joined: Wed Jun 28, 2017 4:41 am

[Solved] Acquiring the Data in tablegrid and loop it

Post by ouchd'greyt »

Hi,

Thank you for kindness response, i appreciated it,
I do alternative way on how to appear the selected data from the table grid to my record cell, when the push button get push its label will also change (ex: the label of push button is "item 1" after pressing the button the selected data will transfer/appear to my record cell then the push button label will now change to "item 2" and so on and so forth).


But, i will also try your code, to know what would happen.

Thanks very much!
Last edited by ouchd'greyt on Mon Jul 31, 2017 5:44 am, edited 1 time in total.
OpenOffice 4.1.2 on Windows 7
UnklDonald418
Volunteer
Posts: 1547
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: [Writer] Aquiring the Data in tablegrid and loop it

Post by UnklDonald418 »

What happens if you set a Breakpoint and single step through your macro?
Does it then work correctly, or is the macro firing 3 times?
If you upload a sample file so we can see what is happening, then maybe someone can help.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Writer] Aquiring the Data in tablegrid and loop it

Post by Villeroy »

Writer:
tbl = ThisComponent.TextTables.getByName("Table 1")

Calc:
tbl = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("A1:C99")

Both:
a() = tbl.getDataArray()

Now you have a nested array of row arrays in variable a.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply