Ottieni oggetti serie di icone, barre di dati o scala colori usati nella formattazione condizionale
Contents
[
Hide
]
A volte è necessario recuperare serie di icone utilizzate nella formattazione condizionale di una cella o di un intervallo di celle e si desidera creare un file immagine basato su di esse. Potresti avere bisogno di leggere le barre di dati o le scale colori utilizzate nella formattazione condizionale. Aspose.Cells supporta questa funzionalità.
Il seguente esempio di codice mostra come leggere i set di icone usati per la formattazione condizionale. Con l’API semplice di Aspose.Cells, i dati immagine del set 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
const AsposeCells = require("aspose.cells.node"); | |
const path = require("path"); | |
// The path to the documents directory. | |
const dataDir = path.join(__dirname, "data"); | |
// Open a template Excel file | |
const workbook = new AsposeCells.Workbook(path.join(dataDir, "book1.xlsx")); | |
// Get the first worksheet in the workbook | |
const sheet = workbook.getWorksheets().get(0); | |
// Get the A1 cell | |
const cell = sheet.getCells().get("A1"); | |
// Get the conditional formatting result object | |
const cfr = cell.getConditionalFormattingResult(); | |
// Get the icon set | |
const icon = cfr.getConditionalFormattingIcon(); | |
// Create the image file based on the icon's image data | |
require("fs").writeFileSync(path.join(dataDir, "imgIcon.out.jpg"), icon.getImageData()); |