Obtener conjuntos de iconos, barras de datos o objetos de escalas de color utilizados en el formato condicional
Contents
[
Hide
]
A veces, necesita recuperar conjuntos de iconos que se utilizan en el formato condicional de una celda o un rango de celdas y desea crear un archivo de imagen basado en ellos. Es posible que necesite leer las barras de datos o las escalas de color utilizadas en el formato condicional. Aspose.Cells admite esta función.
El siguiente ejemplo de código muestra cómo leer conjuntos de iconos que se utilizan para el formato condicional. Con el simple Aspose.Cell de Aspose.Cell, los datos de imagen del conjunto de iconos se guardan como una imagen.
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 a template Excel file | |
Workbook workbook = new Workbook(dataDir+ "book1.xlsx"); | |
// Get the first worksheet in the workbook | |
Worksheet sheet = workbook.Worksheets[0]; | |
// Get the A1 cell | |
Cell cell = sheet.Cells["A1"]; | |
// Get the conditional formatting result object | |
ConditionalFormattingResult cfr = cell.GetConditionalFormattingResult(); | |
// Get the icon set | |
ConditionalFormattingIcon icon = cfr.ConditionalFormattingIcon; | |
// Create the image file based on the icon's image data | |
File.WriteAllBytes(dataDir+ "imgIcon.out.jpg", icon.ImageData); |