News Category

Apply Soft Edges effect to Excel Chart in C#

2018-07-19 09:26:57 Written by  support iceblue
Rate this item
(0 votes)

This article elaborates the steps to apply soft edges effect to an excel chart using Spire.XLS.

The example Excel file we used for demonstration:

Apply Soft Edges effect to Excel Chart in C#

Detail steps:

Step 1: Instantiate a Workbook object and load the excel file.

Workbook workbook = new Workbook();
workbook.LoadFromFile("Input.xlsx");

Step 2: Get the first worksheet.

Worksheet sheet = workbook.Worksheets[0];

Step 3: Get the chart.

IChart chart = sheet.Charts[0];

Step 4: Specify the size of the soft edge. Value can be set from 0 to 100.

chart.ChartArea.Shadow.SoftEdge = 10;

Step 5: Save the file.

workbook.SaveToFile("Output.xlsx", ExcelVersion.Version2013);

Output:

Apply Soft Edges effect to Excel Chart in C#

Full code:

using Spire.Xls;
using Spire.Xls.Core;

namespace Soft_Edges_in_Excel_Chart
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate a Workbook object
            Workbook workbook = new Workbook();
            //Load the Excel file
            workbook.LoadFromFile("Input.xlsx");

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            //Get the chart
            IChart chart = sheet.Charts[0];

            //Specify the size of the soft edge. Value can be set from 0 to 100
            chart.ChartArea.Shadow.SoftEdge = 10;

            //Save the file
            workbook.SaveToFile("Output.xlsx", ExcelVersion.Version2013);
        }
    }
}

Additional Info

  • tutorial_title:
Last modified on Monday, 06 September 2021 02:15