| View previous topic :: View next topic |
| Author |
Message |
Sebo.PL Newbie

Joined: 10 Jan 2007 Posts: 1
|
Posted: Wed Jan 10, 2007 8:46 pm Post subject: Macro that inserts all images from dir to *.odt |
|
|
I've made such macro:
| Code: | sub InsertPNGs
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(3) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FileName"
args1(0).Value = "C:\Documents and Settings\Sebo\My Documents\TSiD\L4\R1\"&Dir$("C:\Documents and Settings\Sebo\My Documents\TSiD\L4\R1\*.png")
args1(1).Name = "FilterName"
args1(1).Value = "<Wszystkie formaty>"
args1(2).Name = "AsLink"
args1(2).Value = false
args1(3).Name = "Style"
args1(3).Value = "Grafika"
do
rem MsgBox args1(0).Value
dispatcher.executeDispatch(document, ".uno:InsertGraphic", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:SetAnchorToChar", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
args1(0).Value = "C:\Documents and Settings\Sebo\My Documents\TSiD\L4\R1\"&Dir$
loop until args1(0).Value="C:\Documents and Settings\Sebo\My Documents\TSiD\L4\R1\"
end sub |
But it does not work as I expected
I think the problem is because ooWrter does not move selectoin from inserted image before inserting paragraph ;]
I don't know which method can I use to make it to do so and I can't find any documentation of avaliable uno methods  |
|
| Back to top |
|
 |
thralia Newbie


Joined: 19 Feb 2007 Posts: 1
|
Posted: Mon Feb 19, 2007 4:04 pm Post subject: re : |
|
|
sebo, as written in this post : http://www.oooforum.org/forum/viewtopic.phtml?t=43912
try to add the following line after the image is inserted :
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
This could give :
dispatcher.executeDispatch(document, ".uno:InsertGraphic", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
for example.
Ciao,
Mikaël |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|