Macro code to copy contents from a saved slide to current

Discuss the presentation application

Macro code to copy contents from a saved slide to current

Postby powermacro » Fri Sep 07, 2018 7:29 pm

I am trying to write a macro that copies the contents (objects, text, etc.) off a single slide in a file saved on the disk, and paste them automatically onto the slide that I am currently editing.

I have an equivalent set of code for Powerpoint, but I'm having difficulty translating this to LibreImpress. In Powerpoint macro basic, the technique would look like this:

oCurrentSlide = ActiveWindow.View.Slide.SlideIndex
...
ActiveWindow.View.GotoSlide (oSlideCopy)
...
Presentations(PPTcount).Slides(oSlideCopy).Shapes.SelectAll
ActiveWindow.Selection.Copy
...
ActiveWindow.View.GotoSlide (oCurrentSlide)
ActiveWindow.View.Paste


I'm wondering if anyone here could help direct me to equivalent functions / methods in OpenOffice / LibreImpress?

Thank you!
LibreOffice 6.0.3.2 on Ubuntu
powermacro
 
Posts: 2
Joined: Fri Sep 07, 2018 7:15 pm

Re: Macro code to copy contents from a saved slide to curren

Postby Zizi64 » Fri Sep 07, 2018 8:26 pm

You can control the Writer, Calc, Draw, and Impress applications and the related documents by the usage of the API functions.
You can call them from all of the supported programming languages - for example: from the built-in StarBasic.
API : Application Programming Interface

See Andrew Pitonyak's free macro programming books.
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.5 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.1 and AOO4.1.5
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.
User avatar
Zizi64
Volunteer
 
Posts: 7768
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Macro code to copy contents from a saved slide to curren

Postby powermacro » Fri Sep 07, 2018 9:20 pm

Thank you. I just read through the 683 page book here: http://www.pitonyak.org/OOME_4_0.odt - that's an impressive work of documentation.

It would appear that the way I'd need to access these is by the com.sun.star.presentation.Shape method and accessors, which is covered in his section 16.2?

However, the critical function that is needed in the Powerpoint code version is the .Slides() selector that selects a slide by number, and then the .Shapes.SelectAll method. It's not obvious to me that the second method is available in StarBasic?

What I was able to find was in section 11.3, the function example CopyToClipboard_API() but that doesn't show the SelectAll functionality that I would need to call beforehand - it appears to only work on a single object method at a time?
LibreOffice 6.0.3.2 on Ubuntu
powermacro
 
Posts: 2
Joined: Fri Sep 07, 2018 7:15 pm


Return to Impress

Who is online

Users browsing this forum: No registered users and 3 guests