[Solved] search macro [DRAW]
Posted: Tue Jun 05, 2018 10:21 am
Hello,
I have pdf document that I open in LibreOffice Draw. There are around 100 pages, almost similar. I need to insert image on page, if there is e.g string called (lets say) "EX". I have macro that insert image, so its not a problem, but I have a problem with insert that image on page that should be here ("EX").
I recorded macro that search for "EX":
It's working, selecting that string but when I'm running then macro "insert image" it appears on page 1 (I have called it index=0). Is it possible to get page index where is string "EX"
Or I have second thought, dont know it can works. When I run macro there pops MSGBox "write amount of pages".
Here is variable with amount of pages, lets say 'p_amount'.
So I have:
p_amount=p_amount-1
index=0
for index=0 To p_amount
{macro insertmage}
next index
Its filling all pages with that image. Is it possible to do loop something like that?
p_amount=p_amount-1
index=0
for index=0 To p_amount
"IF search for EX"
then
{macro insertmage}
end IF
next index
I hope you understood it, my english is very bad so its hard to explain what I mean correctly
Greetings!
I have pdf document that I open in LibreOffice Draw. There are around 100 pages, almost similar. I need to insert image on page, if there is e.g string called (lets say) "EX". I have macro that insert image, so its not a problem, but I have a problem with insert that image on page that should be here ("EX").
I recorded macro that search for "EX":
Code: Select all
REM ***** BASIC *****
Sub searchEX
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(1).Name = "SearchItem.SearchString"
args1(1).Value = "ex"
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
End Sub
Or I have second thought, dont know it can works. When I run macro there pops MSGBox "write amount of pages".
Here is variable with amount of pages, lets say 'p_amount'.
So I have:
p_amount=p_amount-1
index=0
for index=0 To p_amount
{macro insertmage}
next index
Its filling all pages with that image. Is it possible to do loop something like that?
p_amount=p_amount-1
index=0
for index=0 To p_amount
"IF search for EX"
then
{macro insertmage}
end IF
next index
I hope you understood it, my english is very bad so its hard to explain what I mean correctly
Greetings!