how hide multiple pictures on my xls/calc with a checkbox ?
You’ve got to write a program.
Why you want to store images in a Spreadsheet application?
Why you use such obsolete and foreign file format like the .xls?
Otherwise your task can be achieved by some macros - in an .ods type file.
Here is something very close. It uses a data-validated cell rather than a checkbox. This is an easier approach. [I can’t test using a checkbox because the machine I’m using doesn’t have the JRE installed. That said, most of the code for a checkbox event is there.]
The core functionality–the program Villeroy is talking about–is:
Function SetImageVisibility(State)
Dim Sheet As Object
Dim Index As Integer
Dim DrawPage As Object
Dim Graphic As Object
Sheet = ThisComponent.getSheets().getByIndex(0) 'Or pass in Index
DrawPage = Sheet.getDrawPage()
For Index = 0 to DrawPage.getCount() - 1
Graphic = DrawPage.getByIndex(Index)
On Error Goto Handler 'Should probably clean up using interface query
If Instr(Graphic.GraphicURL.MimeType,"image") Then
Graphic.Visible = State
EndIf
Handler:
On Error Goto 0
Next Index
SetImageVisibility = DrawPage.getCount()
End Function
CheckForPics.ods (247.8 KB)
JRE required, for my friends it’s obstacle, but i have one more solution now :
my other solution: