588 / 5.000
Vertaalresultaten
Vertaalresultaat
Good day everyone. I am trying to create a macro for a button to show or hide specific Rules for columns, I have already done this. But for rules. Can I find too little information? Who oh who would want and be able to help me. I would be gratefull.
this is what i tried. This is derived from my macro that hides a column via a button.
REM ***** BASIC *****
sub toggle_Rows_1ePart
doc = thisComponent
sheet = doc.CurrentController.ActiveSheet
rows = sheet.rows("14,15,16,17")
rows.IsVisible = not rows.IsVisible
end sub
Last edited by robleyd on Wed Apr 24, 2024 2:47 am, edited 1 time in total.
Reason:Tagged [Solved]. Add green tick
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM) Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4) Libreoffice 24.8… flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
Sub hideRows14_17()
oDoc=ThisComponent
oSheet=oDoc.CurrentController.ActiveSheet
myRange=oSheet.getCellRangeByPosition(,13,,16)
myRange.Rows.IsVisible=false
End Sub
Mind you getCellRangeByPosition takes as arguments (start_column,start_row,end_column,end_row) hence (,13,,16) Rows are zero based.
____________
DiGro
AOO 4.1.15 (Dutch) on Windows 11. Scanned with Ziggo Safe Online (F-Secure)
Apart from the IDE help file, Pitonyak's free books, searching here - someone's usually already asked a similar question -
there is the MRI Object Inspector which is invaluable.
If, however, the questioner is eager to learn more about using the API in custom code:
Information that may change (here mainly the row range to be treated) should not be hard coded in a Sub if avoidable.
Any FormControl object like the PushButton in this case has a property .Tag which can be used to pass special information to the called code. For the UI (en) this property is circumscribed as "Additional information".
See attached example.
If you cross post, as a courtesy please let us know that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.
Edit: Solved - see the AskLibreOffice link
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.8.2.1; SlackBuild for 24.8.2 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue
Unexpected '{' on line 32
If you cross post, as a courtesy please let us know that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.
Edit: Solved - see the AskLibreOffice link
Yes the same answer as on the other Forum. Sorry I didn't know this had to be reported, But I see that this message is already marked as resolved. Thank you