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

Free Support Forum - aspose.com

Setting ChartTextBlockFormat.WrapText to NullableBool.False has no effect

I am trying to modify the label of a DataPoint of a ScatterSeries in Aspose.Slides but without success.

I am creating and editing the label with the following code:

ISlide slide = ...;
IShapeCollection shapes = slide.Shapes;
IChart chart = shapes.Where(s => s.Name == "Diagram").First() as IChart;
var series = chart.ChartData.Series;
// [ adding Points ]
var currentPoint = series[0].DataPoints.Last();
IDataLabel label = currentPoint.Label;

IPortion portion = new Portion();

portion.Text = "Test and test";

label.AddTextFrameForOverriding("");
label.TextFrameForOverriding.Paragraphs[0].Portions.Add(portion);

IChartTextBlockFormat textBlockFormat = label.TextFormat.TextBlockFormat;
textBlockFormat.WrapText = NullableBool.False;
textBlockFormat.AutofitType = TextAutofitType.Normal;

This does not change the word wrapping behaviour of the label I created.

It also seems that I cannot change the label’s width by using
label.Width = someWidth;

It seems that using

label.TextFrameForOverriding.TextFrameFormat.WrapText = NullableBool.False;

has solved the word wrap problem. But I am still not able to change the width of the label.

Problem solved by using these lines (I am actually ok with only fitting the shape to the text):

label.TextFrameForOverriding.TextFrameFormat.WrapText = NullableBool.False;   
label.TextFrameForOverriding.TextFrameFormat.AutofitType = TextAutofitType.Shape;

IChartTextBlockFormat textBlockFormat = label.TextFormat.TextBlockFormat;
textBlockFormat.WrapText = NullableBool.False;

@jstropeltalvaro,
I am glad you found the solution yourself.