[Solved] How to select the entire row of a table?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Collytze
Posts: 3
Joined: Tue Dec 20, 2022 4:23 am

[Solved] How to select the entire row of a table?

Post by Collytze »

In the speadsheet file,I wanna get the entire row of a table by clicking mouse,but I don't know how to do it in OpenOffice basic.
In Microsoft VBA,I can use 'Application.inputbox' to select a table range,but OpenOffice basic has not a given function like this.
I'm looking forward to your help.
Thank you.
Last edited by Collytze on Wed Dec 21, 2022 12:21 am, edited 1 time in total.
LibreOffice 4.7 on Windows
User avatar
Zizi64
Volunteer
Posts: 11365
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to select the entire row of a table?

Post by Zizi64 »

Just click on the empty numbered grey rectangle near (left side of) the column A.

Sorry, I see now it is a StarBasic + API related question.

You must study the API of the OpenOffice. Start with Anrew Pitonyak's free macro books.
https://www.pitonyak.org/oo.php

Sometimes - when you vant to control a whole row by a macro, you not needed to select (highlight) the row visually. It is enough to get the Row object. You must get the actual Spereadsheet document first, for example:

Code: Select all

oDoc = Thiscomponent
Then you must get the specific Sheet (by its index, by Name, or by the actual selection).

Finally you will able to get the Row, CellRange or Cell object.

I suggest you to download, install and use one of the excellent Object Inspection Tools: XrayTool or MRI. Then you will able to list all of the existing properties and methods of the programming objects.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Collytze
Posts: 3
Joined: Tue Dec 20, 2022 4:23 am

Re: How to select the entire row of a table?

Post by Collytze »

Thanks for your answer. I got what you mean.
If I need creating a dialog function that a dialogbox appears with the selection information displayed in the dialogbox and the table rows can be selected by the user when the code runs, rather than pre-specified in the code?
Could you help me build a function like this?
LibreOffice 4.7 on Windows
User avatar
Zizi64
Volunteer
Posts: 11365
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to select the entire row of a table?

Post by Zizi64 »

the table rows can be selected by the user when the code runs,
You can select the row(s) (visually, by usage of the user interface) only before or after macro running.
You can control the rows by their number if you apply a drop-down selector with the row number during the macro running.


Do you want to fill some rows with some data by usage the macro and the dialog boxes on a Form?
Do you know about the built-in Calc feature named "Form"? Available from the menu (of the LibreOffice): Data - Form... it is for fill-in cellranges row-by-row.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11365
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to select the entire row of a table?

Post by Zizi64 »

Could you help me build a function like this?
Please study the free Macro books first. And there are many sample codes related to the Forms and the Form control elements on the Forums.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2786
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to select the entire row of a table?

Post by JeJe »

This will show a normal input box then if you input an address such as D6:G6 it will select that.

Code: Select all

sub InputBoxForCellRange
res = inputbox("Input cell range address")

with thiscomponent.currentcontroller

A = .activesheet.getCellRangeByName(res)
.select(A)

end with
end sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Collytze
Posts: 3
Joined: Tue Dec 20, 2022 4:23 am

Re: How to select the entire row of a table?

Post by Collytze »

Thanks for your reply.I know this way, but it seems that selecting the table area by mouse is more intuitive than typing the address.Probably that's my personal feeling.
LibreOffice 4.7 on Windows
JeJe
Volunteer
Posts: 2786
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to select the entire row of a table?

Post by JeJe »

Now, I'm confused as to what you're asking? If it has nothing to do with macros and you just want to select a row with the mouse, you click the row number on the left of the spreadsheet.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to select the entire row of a table?

Post by Villeroy »

t109099.ods
(14.18 KiB) Downloaded 279 times
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