Search code examples
asposeaspose-slides

Position title Aspose slide chart


Is it possible to position the title of a Aspose powerpoint slide chart?

I have tried following:

chart.ChartTitle.X = 100;
chart.ChartTitle.Y = 100;

With different values but title is not moved.


Solution

  • Since it is not possible to move the chart title I simply created a title just above the chart using a regular autoshape, something like this:

    IAutoShape autoshape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 20, 0, 600, 50);
    autoshape.UseBackgroundFill = true;
    autoshape.LineFormat.FillFormat.FillType = FillType.NoFill;
    autoshape.AddTextFrame(" ");
    ITextFrame txtFrame = autoshape.TextFrame;
    IParagraph para = txtFrame.Paragraphs[0];
    IPortion portion = para.Portions[0];
    portion.Text = title;
    portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
    portion.PortionFormat.FillFormat.FillType = FillType.Solid;