使用 Aspose.Cells for Python via .NET 设置图表图例项填充为无
Contents
[
Hide
]
如果您想设置图表图例条目填充的文本为无色,以便它不会显示在图例中,请将LegendEntry.is_text_no_fill设置为true。
以下示例代码将图表的第二个图例条目填充的文本设置为无色。请下载这段代码中使用的sample excel file和由此生成的output excel file进行参考。
以下屏幕截图突出显示了此代码对sample excel file的影响。
This file contains hidden or 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
from aspose.cells import SaveFormat, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Open the template file. | |
workbook = Workbook(dataDir + "Sample.xlsx") | |
# Access the first worksheet | |
sheet = workbook.worksheets[0] | |
# Access the first chart inside the sheet | |
chart = sheet.charts[0] | |
# Set text of second legend entry fill to none | |
chart.legend.legend_entries[1].is_text_no_fill = True | |
# Save the workbook in xlsx format | |
workbook.save(dataDir + "ChartLegendEntry_out.xlsx", SaveFormat.XLSX) |