How to Draw Flowchart Programmatically in Open Office Draw

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
alok21
Posts: 4
Joined: Sat Nov 09, 2013 8:30 pm

How to Draw Flowchart Programmatically in Open Office Draw

Post by alok21 »

Using UNOruntime api I want to generate flowchart programmatically in Open Office Draw.How can I do this.Pls suggest.Using follwing code I was able to open Open Office Draw but was unable to proceed further:-

String oooExeFolder = "C:\\Program Files\\LibreOffice 4.0\\program\\";

XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
//XComponentContext xContext = Bootstrap.bootstrap();

// Get the remote office service manager
XMultiComponentFactory xMCF = xContext.getServiceManager();

// Get the root frame (i.e. desktop) of openoffice framework.
Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);

// Desktop has 3 interfaces. The XComponentLoader interface provides ability to load components.
XComponentLoader xCLoader = ( XComponentLoader ) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);

String officeType = "sdraw";
document = xCLoader.loadComponentFromURL("private:factory/" + officeType, "_blank", 0, new PropertyValue[0]);
Open Office 3.4.1,Windows XP
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to Draw Flowchart Programmatically in Open Office Dr

Post by Villeroy »

This requires a whole library on top of an adequate set of templates, styles and custom shapes.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply