Showing Cell Range as the Data Labels
Contents
[
Hide
]
In Microsoft Excel 2013, you can display a cell range for data labels. Aspose.Cells supports this feature.
Check-box to Show Cell Range as Data Labels
To show the cell range as data labels in Microsoft Excel:
- Select the series data labels and right-click to open the context menu.
- Select Format Data Labels. Label options are displayed.
- Select or clear the option Label Contains - Value From Cells.
The sample code below accesses a chart series data labels and sets the DataLabels.ShowCellRange property to true to select the Label Contains - Value From Cells option.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create workbook from the source Excel file | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Access the chart inside the worksheet | |
Chart chart = worksheet.Charts[0]; | |
// Check the "Label Contains - Value From Cells" | |
DataLabels dataLabels = chart.NSeries[0].DataLabels; | |
dataLabels.ShowCellRange = true; | |
// Save the workbook | |
workbook.Save(dataDir + "output_out.xlsx"); |