ShapeCollection.AddTextEffectInChart

ShapeCollection.AddTextEffectInChart method

Inserts a WordArt object to the chart

public Shape AddTextEffectInChart(MsoPresetTextEffect effect, string text, string fontName, 
    int size, bool fontBold, bool fontItalic, int top, int left, int height, int width)
ParameterTypeDescription
effectMsoPresetTextEffectThe mso preset text effect type.
textStringThe WordArt text.
fontNameStringThe font name.
sizeInt32The font size
fontBoldBooleanIndicates whether font is bold.
fontItalicBooleanIndicates whether font is italic.
topInt32Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
leftInt32Represents the vertical offset of shape from the upper left corner in units of 1/4000 of the chart area.
heightInt32Represents the height of shape, in units of 1/4000 of the chart area.
widthInt32Represents the width of shape, in units of 1/4000 of the chart area.

Return Value

Returns a Shape object that represents the new WordArt object.

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Charts;

namespace AsposeCellsExamples
{
    public class ShapeCollectionMethodAddTextEffectInChartWithMsoPresetTextEffectStringStrinDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Access first worksheet and add sample data
            Worksheet worksheet = workbook.Worksheets[0];
            worksheet.Cells["A1"].PutValue(50);
            worksheet.Cells["A2"].PutValue(100);
            worksheet.Cells["A3"].PutValue(150);
            
            // Add a chart
            int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);
            Chart chart = worksheet.Charts[chartIndex];
            chart.NSeries.Add("A1:A3", true);
            
            // Add WordArt to the chart
            Shape wordart = chart.Shapes.AddTextEffectInChart(
                MsoPresetTextEffect.TextEffect2,
                "SAMPLE TEXT", 
                "Arial Black", 
                36, 
                false, 
                false,
                100,  // Left position
                100,  // Top position
                300,  // Width
                200); // Height
                
            // Customize the WordArt appearance
            wordart.FillFormat.Transparency = 0.7;
            wordart.LineFormat.IsVisible = false;
            
            // Save the workbook
            workbook.Save("WordArtInChart.xlsx");
        }
    }
}

See Also