Free Support Forum - aspose.com

How to programmatically create an organisational/heirarchy chart in PPTX?

I want to create an organisational chart through the API. I have a data set in JSON array format, with format like:

[ 
   {id: '1', name: 'Parent', parent: ''},
   {id: '2', name: 'Child_1', parent: '1'},
   {id: '3', name: 'Child_2', parent: '1'}
]

I can customize the format of the data set in any format, but I can’t seem to find any method to create an org chart anywhere in the documentation for Aspose Slides (Java).

I am an employee at Jubilant Life Sciences, and we are currently in the middle of a project in which we want to create org charts using a custom dataset generated through employee database. We are quite interested in purchasing the licenses of your ASPOSE Slides APIs, but we are stuck at the problem that I have mentioned above and it’s very critical.

@tanujd_203,

I have observed your requirements and like to share that Aspose.Slides offers to add SmartArt shapes that can have organizational charts in it. I suggest you to please try using this documentation link for your kind reference in this regard.

Many Thanks,

Mudassir Fayyaz

Whenever I use the code below to create a pptx file and open it, microsoft powerpoint gives the error that the repair is needed to run the file. Repairing the file yields an empty slide in the ppt…

	String dataDir = "C:\\Users\\UserDefault\\Desktop\\";

	Presentation pres = new Presentation();

	ISmartArt smart = pres.getSlides().get_Item(0).getShapes().addSmartArt(10, 10, 400, 300,
			SmartArtLayoutType.OrganizationChart);

	smart.getNodes().get_Item(0).setOrganizationChartLayout(OrganizationChartLayoutType.LeftHanging);

	pres.save(dataDir + "output.pptx", SaveFormat.Pptx);
	System.out.println("done");

Also, I am not able to figure out how can I draw a connector between two nodes, or define a parent-child relation belween nodes. I can’t find this in documentation.

@tanujd_203,

I have worked with sample code shared and generated presentation open fine on my end without any issue in PowerPoint 2010. For your kind reference, I have attached generated presentation as well. Can you please share which version of PowerPoint you are using on your end that gives error. Please also share the details of the issue as well.

Moreover, in attached presentation hierarchy chart, nodes are connected. Can you please share details about the requirement of connectors as well.

Many Thanks,

Mudassir Fayyaz

output.zip (28.9 KB)

Hi Mudassir,

I was able to resolve that repair error problem. Actually I was using

import com.aspose.pdf.SaveFormat;

instead of

import com.aspose.slides.SaveFormat;

Also, I am unable to download the zip file at https://forum.aspose.com/uploads/discourse_instance3/3823.
It’g giving me HTTP error 500: This page isn’t working (forum.aspose.com is currently unable to handle this request).

Can you please share a working link. Thank you.

I want to create a chart somewhat like this:

Thanks,
Tanuj

@tanujd_203,

I have observed your comments. I like to inform that i am successfully able to download this file. Can you please try this once again on your end. If there is still an issue than i will share file with you via email.

Best Regards,

@tanujd_203,

I have observed that you have shared similar inquiry in other forum thread as well and have responded you there. Please check the shared link for your convenience.

Many Thanks,

Mudassir Fayyaz

Yes, you can close this ticket. Thank you for your support :grin:

I am also having a similar requirement. is there any sample available to use it directly?

@ajeyaprakash148

Aspose.Slides offers to add SmartArt shapes that can have organizational charts in it. I suggest you to please try using this documentation link for your kind reference in this regard.

Hi Mudassir,

It looks like that link is for java. I am looking for .net. but I am more interested in a sample to build the organization chart dynamically from an Employee table where it has Id, Name, ParentId something like that. and for all those who are looking for aspose, they may have a same requirment. do you have a sample which builds smart art org chart based on this Flat Employee list.

It would save our time to build our own.