Obtenir des jeux d'icônes, des barres de données ou des échelles de couleurs Objets utilisés dans le formatage conditionnel

Contents
[ ]

L’exemple de code suivant montre comment lire les jeux d’icônes utilisés pour la mise en forme conditionnelle. Avec le simple API de Aspose.Cell, les données d’image du jeu d’icônes sont enregistrées en tant qu’image.

// 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);