Ottieni oggetti serie di icone, barre di dati o scala colori usati nella formattazione condizionale
Contents
[
Hide
]
A volte, è necessario recuperare set di icone usati nella formattazione condizionale di una cella o di un intervallo di celle e creare un file immagine basato su di essi. Potresti dover leggere le barre dei dati o le scale di colore usate nella formattazione condizionale. Aspose.Cells per Python via .NET supporta questa funzione.
Il seguente esempio di codice mostra come leggere serie di icone utilizzate per la formattazione condizionale. Con la semplice API di Aspose.Cell, i dati di immagine della serie di icone vengono salvati come immagine.
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 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 a template Excel file | |
workbook = Workbook(dataDir + "book1.xlsx") | |
# Get the first worksheet in the workbook | |
sheet = workbook.worksheets[0] | |
# Get the A1 cell | |
cell = sheet.cells.get("A1") | |
# Get the conditional formatting result object | |
cfr = cell.get_conditional_formatting_result() | |
# Get the icon set | |
icon = cfr.conditional_formatting_icon | |
# Create the image file based on the icon's image data | |
with open(dataDir + "imgIcon.out.jpg", "wb") as f: | |
f.write(icon.image_data) |