Can anyone point me to, or provide a snippet, of obtaining the Impress Object and inserting a slide in Java? I have googled for a while trying to get a handle on the API. Unfortunate software names blocks me from getting results, e.g. 'uno java impress' gets me Italian / Spanish hits using javascript -> opción número uno.
edit:::::::::::::
Thanks FJCC! I tried to make-build a similar tool written in Java that (sadly) was overly complicated. The Python tool MRI was exactly what I needed.
[Solved] Using java-UNO to insert slide
- victor_charlie
- Posts: 1
- Joined: Thu Aug 23, 2012 2:44 am
- Location: Texas Hill Country
[Solved] Using java-UNO to insert slide
Last edited by victor_charlie on Thu Aug 23, 2012 3:50 pm, edited 1 time in total.
LibreOffice 3.4.4 / OOO340m1(Build:402) on AMD64 Ubuntu 11.10
Re: Using java-UNO to insert slide
You can save yourself innumerable hours by getting an object inspector like MRI. I used it to record this Java code to add a slide to an existing presentation. oInitialTarget is the document.
Code: Select all
import com.sun.star.drawing.XDrawPage;
import com.sun.star.drawing.XDrawPages;
import com.sun.star.drawing.XDrawPagesSupplier;
import com.sun.star.uno.UnoRuntime;
static public void snippet(Object oInitialTarget)
{
XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface(
XDrawPagesSupplier.class, oInitialTarget);
XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
XDrawPage xDrawPage = xDrawPages.insertNewByIndex(1);
}
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: [Solved] Using java-UNO to insert slide
Have you seen the developer guide, most of its snippets are in Java and also is divided by Modules, impress is a bit odd, since both impress and draw are builted under the same basic object.
The XDawPages is the right supplier to insert new pages. including the method pointed by FJCC insertNewByIndex() under DrawingMasterPages
The XDawPages is the right supplier to insert new pages. including the method pointed by FJCC insertNewByIndex() under DrawingMasterPages
AOO 4.1.1 on Arch Linux