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

Free Support Forum - aspose.com

Text not readable in large Organisation Charts

I am using aspose slides JAR for java. When I try to make large charts, the text becomes non-readable (refer the image below).

Capture1.PNG (11.3 KB)

If I we manage to increase the SmartArt Node’s box default height, so the text can get wrapped and in-turn the text-size gets increased automatically (refer image below).

Capture2.PNG (14.1 KB)

If possible, how can these solution be implemented?

@tanujd_203,

I have observed your comments. Can you please share source code so that we may further investigate to help you out.

Hi Adnan,

Unfortunately I can’t share the whole code as json format data is sent from front-end to the servlet, and in that servlet, I have developed a logic that converts the json data set to an organisation chart.

Although, here is the basic code that enables me to make an organisation chart:

public static void TestConnetors()
{
 Presentation pres = new Presentation();

// Access the presentation slide
ISlide slide = pres.getSlides().get_Item(0);
// Add Smart Art IShape
ISmartArt smart = slide.getShapes().addSmartArt(0, 0, 400, 400, SmartArtLayoutType.OrganizationChart);

ISmartArtNode parentNode = smart.getAllNodes().get_Item(0);

parentNode.getTextFrame().setText("H S Bhartia\nCCMD");

while (parentNode.getChildNodes().size() > 0) {
        parentNode.getChildNodes().removeNode(0);
}

SmartArtNode chNode0_1 = (SmartArtNode) ((SmartArtNodeCollection) parentNode.getChildNodes())
                .addNodeByPosition(0);

chNode0_1.getTextFrame().setText("Raju Sunil Mistry\nChief Human Resources Officer");

SmartArtNode chNode1 = (SmartArtNode) ((SmartArtNodeCollection) chNode0_1.getChildNodes()).addNodeByPosition(0);
chNode1.getTextFrame().setText("Shivshant Kumar\nGeneral Manager - HRIS");

ISmartArtShapeCollection shapes = chNode0_1.getShapes();
for (int i = 0; i < shapes.size(); i++) {
        ISmartArtShape sh = shapes.get_Item(i);
        if (sh.getShapeType() == -1 || sh.getShapeType() == 0 || sh.getShapeType() == 1) {
                sh.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
                sh.getLineFormat().setWidth(2);
        }
}


ISmartArtShapeCollection shapes2 = chNode1.getShapes();
for (int i = 0; i < shapes2.size(); i++) {
        ISmartArtShape sh = shapes2.get_Item(i);
        if (sh.getShapeType() == -1 || sh.getShapeType() == 0 || sh.getShapeType() == 1) {
                sh.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.BLACK);
                sh.getLineFormat().setWidth(2);
        }
}

// Save Presentation
pres.save("C:\\Aspose Data\\pptxFont2.pptx", SaveFormat.Pptx);   
}

In the above code, if I’ll be able to somehow change the default height of a SmartArtNode box, that would resolve my issue…

Hi Adnan. Can you please revert me on this?
Purchasing the licenses for Aspose depends alot on this issue in our project.

I just want to change the default height of a SmartArtNode, so that it would enable the text to take more space and font-size of text will also get increased.

Increase in the overall height of the whole chart is not an issue.

Please let me know whether it can or cannot be done.

Thanks,
Tanuj

@tanujd_203,

I have observed your comments. I have shared code snippet. This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

ISmartArtShapeCollection shapes = chNode0_1.getShapes();
for (int i = 0; i < shapes.size(); i++) {
ISmartArtShape sh = shapes.get_Item(i);
if (sh.getShapeType() != -1 || sh.getShapeType() != 0 || sh.getShapeType() != 1 || sh.getShapeType() != 2) {
sh.setWidth(200);
sh.setHeight(200);
sh.getLineFormat().getFillFormat().getSolidFillColor().setColor(java.awt.Color.WHITE);
sh.getLineFormat().setWidth(0);
}
}

Hi Adnan,

Using this code gives me following error:

com.aspose.slides.ms.pbdb106a0.cw: Setting frame properties for SmartArtShape are not implemented yet.

I there something wrong in the bit you shared?

@tanujd_203,

I have observed your comments. Can you please try to use it on Aspose.Slides for Java 17.7. Please share feedback with us if there is still an issue.

Its working, but the thing is…I dont want to fix the height. I want to height value to be variable, according to the numbers of nodes in the chart. I just want the node to be longer in height, instead of it being wide.

@tanujd_203,

I am unable to understand your requirements. Can you please explain that in more details. I like to share that you can change Height and Width as you want. There are no fix values for Height and Width, you may increase only height. I have also shared my generated result along with sample code for your kind reference. Please see attachment.sample.zip (29.9 KB)

I Adnan, I think I need to rephrase my requirement.

I want to size of the nodes to adjust automatically, depending on the size of the content. If the content is too much, I want the node box to adjust it’s width/height automatically, so that the text doesn’t overflow out of the node’s boundary.

I want the node to autofit the text inside by adjusting it’s height/width to avoid overflow of text out of the node.

@tanujd_203,

I have observed your requirements. I regret to inform that this is not possible in Aspose.Slides yet. An issue with ID SLIDESJAVA-36606 has been created as a new feature request in our issue tracking system to further investigate the possibility of implementing the mentioned requirements. I request for your patience until further feedback is shared by our product team.