Etichetta dati personalizzata Rich Text del punto del grafico
Contents
[
Hide
]
È possibile utilizzare Aspose.Cells per creare un’etichetta dati personalizzata RTF del punto del grafico. Aspose.Cells fornisce ilDataLabels.Characters() metodo per restituire ilImpostazione carattere oggetto che può essere utilizzato per impostare le proprietà del carattere del testo come colore, grassetto, ecc.
Etichetta dati personalizzata Rich Text del punto del grafico
Il codice seguente accede al primo punto del grafico della prima serie, ne imposta il testo e quindi imposta il carattere dei primi 10 caratteri impostando il suo colore su rosso e l’audacia suVERO.
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 a workbook from source Excel file | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Access the first chart inside the sheet | |
Chart chart = worksheet.Charts[0]; | |
// Access the data label of first series first point | |
DataLabels dlbls = chart.NSeries[0].Points[0].DataLabels; | |
// Set data label text | |
dlbls.Text = "Rich Text Label"; | |
// Set the font setting of the first 10 characters | |
FontSetting fntSetting = dlbls.Characters(0, 10); | |
fntSetting.Font.Color = Color.Red; | |
fntSetting.Font.IsBold = true; | |
// Save the workbook | |
workbook.Save(dataDir + "output_out.xlsx"); |