Table of Contents

Class XlsChartLegendEntry

Namespace
Spire.Xls.Core.Spreadsheet.Charts
Assembly
Spire.XLS.dll
public class XlsChartLegendEntry : XlsObject, IExcelApplication, IDisposable, IChartLegendEntry
Inheritance
XlsChartLegendEntry
Implements
Derived
Inherited Members

Properties

BackgroundMode

Display mode of the background.

public ChartBackgroundMode BackgroundMode { get; set; }

Property Value

ChartBackgroundMode

Index

Represents index in collection.

public int Index { get; set; }

Property Value

int

IsDeleted

If true then this entry deleted. otherwise false. The following code illustrates use of IsDeleted property:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeIChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["B2:C6"];//Set chart typechart.ChartType = ExcelChartType.Cone3DClustered;//Create a chartLegendIChartLegend chartLegend = chart.Legend;chartLegend.LegendEntries[0].Delete();//True if the entry is deletedbool isDeletedEntry = chartLegend.LegendEntries[0].IsDeleted;if(isDeletedEntry){ //Your code here }//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool IsDeleted { get; set; }

Property Value

bool

IsFormatted

Indicates whether the legend entry has been formatted.

public bool IsFormatted { get; set; }

Property Value

bool

LegendEntityIndex

Legend-entry index.

public int LegendEntityIndex { get; set; }

Property Value

int

TextArea

Represents text area. The following code illustrates use of TextArea property:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeIChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["B2:C6"];//Set chart typechart.ChartType = ExcelChartType.Cone3DClustered;//Create a chartLegendIChartLegend chartLegend = chart.Legend;chartLegend.LegendEntries[1].TextArea.Color = Color.Blue;chartLegend.LegendEntries[1].TextArea.Size = 10;chartLegend.LegendEntries[1].TextArea.FontName = "Bernard MT Condensed";//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartTextArea TextArea { get; }

Property Value

IChartTextArea

Methods

BeginUpdate()

public void BeginUpdate()

Clear()

public void Clear()

Clone(object, Dictionary<int, int>, Dictionary<string, string>)

public XlsChartLegendEntry Clone(object parent, Dictionary<int, int> dicIndexes, Dictionary<string, string> dicNewSheetNames)

Parameters

parent object
dicIndexes Dictionary<int, int>
dicNewSheetNames Dictionary<string, string>

Returns

XlsChartLegendEntry

Delete()

Deletes current legend entry. The following code illustrates how to use Delete method for legend:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeIChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["B2:C6"];//Set chart typechart.ChartType = ExcelChartType.Cone3DClustered;//Create a chartLegendIChartLegend chartLegend = chart.Legend;//Delete the first legend entry out of five entireschartLegend.LegendEntries[0].Delete();//Save to fileworkbook.SaveToFile("Chart.xlsx");
public void Delete()

EndUpdate()

public void EndUpdate()