Access Table Control Element with OOo Basic
Access Table Control Element with OOo Basic
Can anyone please tell how to access Table control element with OOo Basic?
To be more precise, I want to access column values in table control.
Can't find anywhere.
To be more precise, I want to access column values in table control.
Can't find anywhere.
-
- Volunteer
- Posts: 283
- Joined: Tue Dec 04, 2007 6:38 pm
- Location: Houston, TX
Re: Access Table Control Element with OOo Basic
you can access it by name from the form. the columns in the table control are also accesible by name
example:
example:
Code: Select all
TableControl=Form.getByName("MyTableControl")
Col1=TableControl.getByName("Col1")
Col2=TableControl.getByName("Col2")
REM and so forth.
Re: Access Table Control Element with OOo Basic
Thanks for reading the post and answering.
What about the values of cell in that table?
For example, to access value of text box I use: oBox.Text = "some text"
What would be the property to access value of each cell.
Or possibly there is property to access values of all cells in certain column?
What about the values of cell in that table?
For example, to access value of text box I use: oBox.Text = "some text"
What would be the property to access value of each cell.
Or possibly there is property to access values of all cells in certain column?
-
- Volunteer
- Posts: 283
- Joined: Tue Dec 04, 2007 6:38 pm
- Location: Houston, TX
Re: Access Table Control Element with OOo Basic
cells in a table control are regular form controls. so you can access their content in the same way
-
- Posts: 28
- Joined: Wed Jun 28, 2017 4:41 am
Re: Access Table Control Element with OOo Basic
thank you guys for the code, but there's a message object variable not set. how can i set the form?
OpenOffice 4.1.2 on Windows 7
-
- Posts: 28
- Joined: Wed Jun 28, 2017 4:41 am
Re: Access Table Control Element with OOo Basic
I tried the code, but there was runtime error message says "object variable not set for this one
TableControl=Form.getByName("MyTableControl")
how to set with this one?
TableControl=Form.getByName("MyTableControl")
how to set with this one?
OpenOffice 4.1.2 on Windows 7
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Access Table Control Element with OOo Basic
Have you defined Form?runtime error message says "object variable not set for this one
TableControl=Form.getByName("MyTableControl")
How are you invoking the macro?
For instance if you are using a button Event then something like
Code: Select all
Form = oEvent.Soure.Model.Parent
If you are trying to access form controls you need to use an object inspection tool.
There is a tutorial on the MRI tool
viewtopic.php?f=74&t=49294
it has a handy feature, once you've navigated to the control or value you are seeking press <Ctrl>h and it will open a window showing code you can use in your macro.
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
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
-
- Posts: 28
- Joined: Wed Jun 28, 2017 4:41 am
Re: Access Table Control Element with OOo Basic
Hi UnklDonald418,
Thank you for your kindness..
It might help..
Thank you for your kindness..
It might help..
OpenOffice 4.1.2 on Windows 7
-
- Posts: 28
- Joined: Wed Jun 28, 2017 4:41 am
Re: Access Table Control Element with OOo Basic
QuazzieEvil wrote:you can access it by name from the form. the columns in the table control are also accesible by name
example:Code: Select all
TableControl=Form.getByName("MyTableControl") Col1=TableControl.getByName("Col1") Col2=TableControl.getByName("Col2") REM and so forth.
hi would like to know how about the acquiring the data or the details under that column?
OpenOffice 4.1.2 on Windows 7
-
- Volunteer
- Posts: 1544
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Access Table Control Element with OOo Basic
If you were using the MRI tool to inspect Col1 you would be able to see all the available properties, Including
CurrentValue
DataField
Name
It would then be easy to make assignments such as:
You can also see a list of properties in the IDE by setting a Breakpoint and using the Watch tool.
CurrentValue
DataField
Name
It would then be easy to make assignments such as:
Code: Select all
val1 = Col1.CurrentValue
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
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11