Legend is not hiding in chart while rendering pptx slide

I am rendering chart from one pptx file to another pptx file. In this, I need to hide the chart legend in target pptx. I have tried following code.

PresentationEx pptPresentationex= new PresentationEx(“input_1.pptx”);
SlidesEx oldslides = pptPresentationex.getSlides();
SlideEx oldslide = oldslides.get(0);
ShapesEx newshapes = oldslide.getShapes();
Iterator itr = newshapes.iterator();
for(int i=0;itr.hasNext();i++)
{
ShapeEx shape = (ShapeEx)itr.next();
if(shape instanceof com.aspose.slides.pptx.ChartEx)
{
ChartEx cx = (ChartEx)shape;
System.out.println(cx.getHasLegend());
cx.setHasLegend(false);
System.out.println(cx.getHasLegend());
}
}

o/p :
true
false (It is setting false).

But legend is not hiding in the chart even though legend set to false. Please someone help us.

Hi Senthil Kumar,


Thanks for your interest in Aspose.Slides.

I have observed the code snippet shared by you and like to share that we are going to share the latest version of Aspose.Slides for Java 3.0.0 by tonight. Hopefully, with release of latest version, the things will work on your end. You may please verify your application with latest available product version.

Many Thanks,

Hi Team,

Ya. It is working fine with aspose version 3.0.

ShapeEx shape = (ShapeEx)itr.next();
if(shape instanceof ChartEx)
{
ChartEx cx = (ChartEx)shape;
LegendEx lex = cx.getLegend();
lex.setHeight(0);
lex.setWidth(0);
}

Thanks for your support.


Hi Senthil Kumar,


You are always welcome. Please share, if I may help you further in this regard.

Many Thanks,