使用 Aspose.Cells 将图表图例条目填充文本设置为无

使用 Aspose.Cells 将图表图例条目填充文本设置为无

以下示例代码将图表的第二个图例条目填充文本设置为无。请下载示例 excel 文件用于此代码和输出excel文件由它生成供您参考。

下面的截图突出显示了这段代码对示例 excel 文件.

待办事项:图片_替代_文本

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(Settextofchartlegend.class);
// Open the template file.
Workbook workbook = new Workbook(dataDir + "sample.xlsx");
// Access the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);
// Access the first chart inside the sheet
Chart chart = sheet.getCharts().get(0);
// Set text of second legend entry fill to none
chart.getLegend().getLegendEntries().get(1).setTextNoFill(true);
// Save the workbook in xlsx format
workbook.save(dataDir + "output.xlsx", SaveFormat.XLSX);