データラベルとしてのセル範囲を表示

セル範囲をデータラベルとして表示するためのチェックボックス

Microsoft Excelでセルの範囲をデータラベルとして表示するには:

  1. シリーズのデータラベルを選択して、コンテキストメニューを開くために右クリックします。
  2. データラベルの書式設定を選択します。ラベルのオプションが表示されます。
  3. ラベルに値を含めるオプションを選択またはクリアします。

以下のサンプルコードは、チャートシリーズのデータラベルにアクセスし、trueラベルに値を含めるオプションを選択するためのDataLabels.ShowCellRangeプロパティを設定します。

// 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");