Charts modification through OOBasic or VB

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Locked
Abishek@0611
Posts: 5
Joined: Thu Jun 08, 2023 11:15 pm

Charts modification through OOBasic or VB

Post by Abishek@0611 »

I need to change the chart shape from bar to Cylinder is there any possible ways to do so
Abishek M
OpenOffice 4.1
Windows 10
Cazer
Posts: 53
Joined: Mon May 15, 2023 11:55 am

Re: Charts modification through OOBasic or VB

Post by Cazer »

You can manipulate charts in OpenOffice using the Apache OpenOffice's BASIC or Visual Basic for Applications (VBA). However, it's worth noting that while Apache OpenOffice can handle VBA scripts, it primarily uses its own language called OpenOffice Basic (OOBasic).
For more detailed information and examples, I recommend checking out the Apache OpenOffice BASIC Programming Guide at https://wiki.openoffice.org/wiki/Docume ... ide/Charts. This guide provides comprehensive information about programming with OOBasic in OpenOffice.
OpenOffice 4.1.14
OS
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Charts modification through OOBasic or VB

Post by JeJe »

If the chart is index 0 in the drawpage of a Writer document - you change the diagram type and set it to 3d like this:

Code: Select all

 oChartDoc = thiscomponent.drawpage.getbyindex(0).getEmbeddedObject()
 oDiagram = oChartDoc.createInstance( "com.sun.star.chart.BarDiagram" ) 
odiagram.Dim3D = true
 oChartDoc.setDiagram( oDiagram )
Diagram types here:

https://www.openoffice.org/api/docs/com ... le-ix.html
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Abishek@0611
Posts: 5
Joined: Thu Jun 08, 2023 11:15 pm

Re: Charts modification through OOBasic or VB

Post by Abishek@0611 »

Screenshot 2023-06-13 104753.png
Screenshot 2023-06-13 104753.png (116.86 KiB) Viewed 2037 times
I Need to get chart like this through VB
Abishek M
OpenOffice 4.1
Windows 10
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Charts modification through OOBasic or VB

Post by JeJe »

If you can create it in the normal way in a document. Use an object inspector like MRI to see what its properties are and change it using the code I posted.

https://github.com/hanya/MRI/releases

Cylinder isn't a type of diagram according to that link I posted - its not there - so use MRI to find out what it is to put instead of com.sun.star.chart.BarDiagram.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Charts modification through OOBasic or VB

Post by JeJe »

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Locked