Interface IChartLegendEntry
Represents a legend entry in a chart legend.
public interface IChartLegendEntry
Properties
BackgroundMode
Display mode of the background.
ChartBackgroundMode BackgroundMode { get; set; }
Property Value
IsDeleted
If true then this entry deleted. otherwise false.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Create a chartLegend
IChartLegend chartLegend = chart.Legend;
chartLegend.LegendEntries[0].Delete();
//True if the entry is deleted
bool isDeletedEntry = chartLegend.LegendEntries[0].IsDeleted;
if(isDeletedEntry){ //Your code here }
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool IsDeleted { get; set; }
Property Value
IsFormatted
True if the legend entry has been formatted.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Create a chartLegend
IChartLegend chartLegend = chart.Legend;
chartLegend.LegendEntries[1].TextArea.Color = Color.Blue;
//True if the legend entry is formatted
bool isEntryFromatted = chartLegend.LegendEntries[1].IsFormatted;
if(isEntryFromatted){ //Your code here }
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool IsFormatted { get; set; }
Property Value
TextArea
Represents text area.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Create a chartLegend
IChartLegend 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 file
workbook.SaveToFile("Chart.xlsx");
IChartTextArea TextArea { get; }
Property Value
Methods
Delete()
Deletes current legend entry.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Create a chartLegend
IChartLegend chartLegend = chart.Legend;
//Delete the first legend entry out of five entires
chartLegend.LegendEntries[0].Delete();
//Save to file
workbook.SaveToFile("Chart.xlsx");
void Delete()