データラベルとしてのセル範囲を表示
Contents
[
Hide
]
Microsoft Excel 2013では、データラベルにセル範囲を表示することができます。Aspose.Cellsはこの機能をサポートしています。
セル範囲をデータラベルとして表示するためのチェックボックス
Microsoft Excelでセルの範囲をデータラベルとして表示するには:
- シリーズのデータラベルを選択して、コンテキストメニューを開くために右クリックします。
- データラベルの書式設定を選択します。ラベルのオプションが表示されます。
- ラベルに値を含めるオプションを選択またはクリアします。
以下のサンプルコードは、チャートシリーズのデータラベルにアクセスし、trueにラベルに値を含めるオプションを選択するためのDataLabels.ShowCellRangeプロパティを設定します。
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"); |