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

Free Support Forum - aspose.com

Controlling wrap text in chart data labels - java/slides

Hi,

Is it possible to set “wrap text in shape” property of data labels of charts created in powerpoint using aspose Java api?

Thanks,
Andy

@andysteady,

I have observed the requirements shared by you and request you to please provide details in the form of sample presentation and snapshot that what you are looking in Aspose.Slides to offer you.

Hi

I’m trying to programatically check the “Wrap text in shape box” - see attached screen shot
The chart I created is a ClusteredBar

image.png (12.3 KB)

Thanks
Andy

@andysteady,

I have observed your comments. As we have requested you earlier please provide sample in form of presentation so that we may investigate further to help you out.

Sure
See attached, graph on the left has the wrap box checked, the one the right does not.
You can see the desired effect on the right where the labels do not wrap

pres.zip (36.4 KB)

@andysteady,

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

            using (Presentation pres = new Presentation())
            {
                IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.ClusteredColumn, 50, 50, 600, 400, true);                    
                IChartSeries series = chart.ChartData.Series[0];
                foreach (IDataLabel label in series.Labels)
                {
                    IChartTextBlockFormat textBlockFormat = label.TextFormat.TextBlockFormat;
                    textBlockFormat.WrapText = NullableBool.False;
                    textBlockFormat.AutofitType = TextAutofitType.Normal;
                    textBlockFormat.MarginTop = 10;
                    textBlockFormat.MarginRight = 10;
                    textBlockFormat.MarginBottom = 10;
                    textBlockFormat.MarginLeft = 10;
                    label.DataLabelFormat.ShowValue = true;
                    label.DataLabelFormat.ShowCategoryName = true;
                }
                pres.Save("pres.pptx", SaveFormat.Pptx);
            }