Legenden Eintragsfüllung des Diagramms auf keinen Text setzen mit Aspose.Cells
Contents
[
Hide
]
Wenn Sie den Text der Diagrammlegendeneintragsfüllung auf keine setzen möchten, sodass er nicht im Diagrammlegendenbereich angezeigt wird, setzen Sie bitte LegendEntry.IsTextNoFill auf true.
Der folgende Beispielcode setzt den Text der zweiten Diagrammlegendeneintragsfüllung auf keine. Laden Sie bitte die Beispieldatei Excel herunter, die in diesem Code verwendet wird, und die Ausgabedatei Excel, die von ihr generiert wird, zur Referenz.
Der folgende Screenshot hebt die Auswirkung dieses Codes auf die Beispieldatei Excel hervor.
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); | |
// Open the template file. | |
Workbook workbook = new Workbook(dataDir + "Sample.xlsx"); | |
// Access the first worksheet | |
Worksheet sheet = workbook.Worksheets[0]; | |
// Access the first chart inside the sheet | |
Chart chart = sheet.Charts[0]; | |
// Set text of second legend entry fill to none | |
chart.Legend.LegendEntries[1].IsTextNoFill = true; | |
// Save the workbook in xlsx format | |
workbook.Save(dataDir + "ChartLegendEntry_out.xlsx", SaveFormat.Xlsx); |