Hello,
I was looking at your forum for a while and I couldn't find what I want to do.
I want to have something like this:
https://prnt.sc/glshm1
I have 3 Picutres of Cats, Dogs, Koalas in one folder, for total of 9 pictures.
I chose a number between range -10000, 100000 only whole numbers, eg no 1.4.
Macro / Program / Function put in that area a picture of different animal.
I change number I see different animal.
Example 1: I put 69 and I see this little fella
https://prnt.sc/glshm1
Example 2: I change number to -69 and I see this little fella:
https://prnt.sc/glsi6v
For 269 it will be different Koala, For -569 it will be different Cat and for 10 000 it will be dog.
If I made something unclear please let me know how I can make such macro / function.
Anything will help, for know I know only what I want I don't know how to even name problems.
Have a great day,
Regards, Pawel
Insert Different Picture for Different Numbers
Insert Different Picture for Different Numbers
OpenOffice Appache 4.1.3 on Windows 8.1
Re: Insert Different Picture for Different Numbers
There are many way to achieve this task.
Here is one from them:
Load all of 9 pictures (manually) into the document, Name them, and then drag them onto same place.
Then you can toggle the Visibility property of the pictures by your macro, depended on the value of the input parameter of your macro subroutine.
Here is a simple example:
Here is one from them:
Load all of 9 pictures (manually) into the document, Name them, and then drag them onto same place.
Then you can toggle the Visibility property of the pictures by your macro, depended on the value of the input parameter of your macro subroutine.
Here is a simple example:
Code: Select all
Sub ShowHide_CalcImage(Pic_Int_Name, Visibility as string)
Dim oDocument, oSheets, oSheet, oDP, oBitmaps, oShape as object
Dim i, j, ShCount as integer
oBitmaps = ThisComponent.createInstance( "com.sun.star.drawing.BitmapTable" )
oDocument = ThisComponent
oSheets = oDocument.Sheets
'oSheet = oSheets.getByName(Sheet_name)
ShCount = oSheets.Count
For j = 0 to ShCount-1
oSheet = oSheets.getByIndex(j) 'get the sheets
oDP = oSheet.GetDrawpage()
for i = oDP.getCount() -1 to 0 step -1
oShape = oDP.getByIndex(i)
if oShape.getName() = Pic_Int_Name then
if Visibility = "Hide" then
oShape.Transparency = 100
else
oShape.Transparency = 0
end if
end if
next i
next j
Thiscomponent.setModified(True)
end sub
'_____________________________________________________________________________________________
Function Set_Visible_Picture(PicName as string)
If PicName = "All" then
ShowHide_CalcImage("1", "Show")
ShowHide_CalcImage("2", "Show")
ShowHide_CalcImage("3", "Show")
ShowHide_CalcImage("4", "Show")
Else
ShowHide_CalcImage("1", "Hide")
ShowHide_CalcImage("2", "Hide")
ShowHide_CalcImage("3", "Hide")
ShowHide_CalcImage("4", "Hide")
ShowHide_CalcImage(PicName, "Show")
End if
Set_Visible_Picture = "Done"
End function
'_____________________________________________________________________________________________
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.
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.
Re: Insert Different Picture for Different Numbers
Awesome, thank you very much! Will play some with that method
OpenOffice Appache 4.1.3 on Windows 8.1