We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using organization tree templates

Hi

I want to use the organization tree template and fill in my custom data . Is it possible to do using Aspose Slides in Java .

Basically I would like to get a handle to each of nodes of the tree and populate content within the same .

Any tips or pointers will definetely be helpful .

Thanks

Hi,

The organization chart is recognized as GroupShape by Aspose.Slides for Java. You can set the alternative text for each node of the tree and then access / update the Text carried by the TextFrame of that node / shape.

In your current ppt, if any of the nodes has alternative text as "abc", its text can be modified as illustrated by the following example.

try {

Presentation pres=new Presentation("Organization+Chart.ppt");

Slide sld=pres.getSlideByPosition(1);

for(int i=0;i<sld.getShapes().size();i++)

{

if(sld.getShapes().get(i) instanceof com.aspose.slides.GroupShape)

{

com.aspose.slides.GroupShape gshp=(com.aspose.slides.GroupShape)sld.getShapes().get(i);

for(int j=0;j<gshp.getShapes().size();j++)

{

if(gshp.getShapes().get(j).getAlternativeText().endsWith("abc"))

{

gshp.getShapes().get(j).getTextFrame().setText("Aspose.Slides.Java Text");

}

}

}

}

pres.write("Organization+Chart123.ppt");

} catch (PptException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

For me, its giving as PictureFrame instead of GroupShape.
Can you please check with attached ppt files?

Hi,

My reply was with respect to your initial post, where you attached a PPT with an organization chart developed in MS PowerPoint 2003. In this ticket 216377, you have provided the PPT that was developed in MS PowerPoint 2007 with SmartArt graphics. In a separted thread by you, I have already mentioned that our development team is working for SmartArt read / write support for PPTX and that thread has been associated with that particular issue. For such PPT loaded in MS PowerPoint 2003, since it does not recognize SmartArt, so it is considered as a PictureFrame.

Hi,
I am able to access data of the ppt attached in 216159 through the code. Is it possible to add new children to the gfroup shape…?
ie. I want to add org chart nodes dynamically. Is it possible?

Hi Muhammed Karattu,

Sure, it is possible. Here is an example how to do that:

try {

Presentation pres=new Presentation("d:\\ppt\\smartart\\Organization+Chart.ppt");

Slide sld=pres.getSlideByPosition(1);

GroupShape gshp=null;

AutoShape ashp=null;

for(int i=0;i<sld.getShapes().size();i++)

{

if(sld.getShapes().get(i) instanceof com.aspose.slides.GroupShape)

{

gshp=(com.aspose.slides.GroupShape)sld.getShapes().get(i);

for(int j=0;j<gshp.getShapes().size();j++)

{

if(gshp.getShapes().get(j).getAlternativeText().endsWith("abc"))

{

if(gshp.getShapes().get(j) instanceof AutoShape)

{

ashp=(AutoShape)gshp.getShapes().get(j);

}

}

}

}

}

Point2D.Float startPt=new Point2D.Float((ashp.getX()) + (ashp.getWidth() / 2), (ashp.getY()) + (ashp.getHeight()));

com.aspose.slides.Rectangle rect=sld.getShapes().addRectangle(ashp.getX(), ashp.getY()+ ashp.getWidth()+50,ashp.getWidth(),ashp.getHeight());

TextFrame tf=rect.addTextFrame("Node by Aspose.Slides");

tf.fitTextToShape();

Point2D.Float endPt = new Point2D.Float(rect.getX()+(rect.getWidth())/2,rect.getY());

gshp.getShapes().addConnector( ConnectorType.STRAIGHT , startPt, endPt);

pres.write("d:\\ppt\\smartart\\Organization+Chart+JAVA.ppt");

} catch (PptException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Thanks for the inputs . The challenge being I dont want to add text boxes and worry about its alignment .

If you open up the PPT4 , and click on the text area . You will be come across an "Organization Chart" menu . Basically we would like to get a handle to the "Insert shape" options and so on , so that we could dynamically add the nodes and use the inbuilt capability of alignment .

Thanks

Hi Muhammed Karattu,

Challenge is met. Try the following code:

try {

Presentation pres=new Presentation("d:\\ppt\\smartart\\Organization+Chart.ppt");

Slide sld=pres.getSlideByPosition(1);

GroupShape gshp=null;

AutoShape ashp=null;

ByteArrayOutputStream bout=new ByteArrayOutputStream();

for(int i=0;i<sld.getShapes().size();i++)

{

if(sld.getShapes().get(i) instanceof com.aspose.slides.GroupShape)

{

gshp=(com.aspose.slides.GroupShape)sld.getShapes().get(i);

for(int j=0;j<gshp.getShapes().size();j++)

{

if(gshp.getShapes().get(j).getAlternativeText().endsWith("def"))

{

if(gshp.getShapes().get(j) instanceof AutoShape)

{

ashp=(AutoShape)gshp.getShapes().get(j);

ashp.serialize(bout);

}

}

}

}

}

Point2D.Float startPt=new Point2D.Float((ashp.getX()) + (ashp.getWidth() / 2), (ashp.getY()) + (ashp.getHeight()));

ByteArrayInputStream bin=new ByteArrayInputStream(bout.toByteArray());

Shape Nodeshp=gshp.getShapes().add(bin);

Nodeshp.setY(ashp.getY()+ ashp.getWidth()+50);

Point2D.Float endPt = new Point2D.Float(Nodeshp.getX()+(Nodeshp.getWidth())/2,Nodeshp.getY());

gshp.getShapes().addConnector( ConnectorType.STRAIGHT , startPt, endPt);

pres.write("d:\\ppt\\smartart\\Organization+Chart+JAVA.ppt");

} catch (PptException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Thanks for the detailed explanation.

Actually, this is not what I am looking for.
Is it possible to do auto insert at a particular node, so that all other nodes get automatically positioned in the groupshape area?

With the logic you have mentioned, If I have to insert new node in between existing nodes, I may need to re-calculate each node position manually and position them, which is not desired.


Don't you support auto insert, autofit, etc for org chart or group shape?

Hi,

Although your requirement is being fullfilled after making some calculations as I have proved through my code snippet. However, for such feature you just desired, an issue with issue id 13413 has been created on our Issue Tracking System. Our development team will invetigate it. This forum thread has been associated with this issue so that you can get an automated notification as soon as this feature is implemented.

Hi,

I too am looking for similar thing in .net.

Can you please tell me how can i generate Org Chart with dynamic data in .net.

the DB could be anything like Sql server / Excel / Access.

The org chart needs to be dynamically building based upon the Data that we have.

Hello sainath,

You will be pleased to hear that Aspose.Slides for .NET 4.4.0 and onwards allows to create charts in PPT. Please use the following documentation link for further investigation. You may try using the latest available version of Aspose.Slides for .NET 4.4.7 for this. In order to use Aspose.Slides for .NET 4.4.7, you may also require Aspose.Cells for .NET 5.2.0. Please download the mentioned product versions from link 1 and link 2 respectively.

Thanks and Regards,

Hi,

Can you give an example of doing Excel organization chart with Aspose.Cells or Aspose.Slides?

Thanks

Hi Alex,

You can create charts using Aspose.Cells and embeds them as Ole frame in Aspose.Slides. Second option is that you may create chart using Aspose.Slides. However, using second option at the moment limited support is available. Please follow documentation link 1 and link 2 for your reference.

Thanks and Regards,

Thanks for your response, Mudassir.

Our ideal solution is to create an organization chart in an Excel file using Asponse.Cells. I would like to know if you have any sample codes for doing an organization chart?

Hi Alex,

Please follow this documentation link for supported chart types in Aspose.Cells for Java. I have requested Aspose.Cells team member to provide you further support in resolving your issue. He will contact you soon.

Thanks and Regards,

Hi,


I am a representative of Aspose.Cells team. I am afraid, currently, Aspose.Cells for Java does not support to create organization charts or diagrams, we have already logged a ticket for the feature with an id: CELLSJAVA-28133. If we have any update about it, we will let you know.

By the way, you may try to programmatically create shapes (lines, rectangles) using Aspose.Cells JAVA API to try to make a diagram if possible.
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/working-with-controls.html

Thank you.

We are currently using the .NET version of Aspose.Cells. Can this be done?

Hi,


I am afraid, this feature is also not available in .NET version of the product.

Sorry for any inconvenience caused!

The issues you have found earlier (filed as SLIDESJAVA-13413) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.