Filtra il tipo di dati durante il caricamento del workbook da file modello con Node.js tramite C++
Il seguente esempio carica soltanto oggetti forma durante il caricamento del workbook dal file modello, che si può scaricare dal link fornito. Il seguente screenshot mostra il contenuto del file modello e spiega anche che i dati di colore rosso e sfondo giallo non saranno caricati perché la proprietà LoadOptions.getLoadFilter() è stata impostata su Shape
Lo screenshot seguente mostra il PDF di output che è possibile scaricare dal link fornito. Qui si può vedere che i dati di colore rosso e sfondo giallo non sono presenti ma ci sono tutte le forme.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// Source directory
const sourceDir = path.join(__dirname, "data");
// Output directory
const outputDir = path.join(__dirname, "output");
// Set the load options, we only want to load shapes and do not want to load data
const loadOptions = new AsposeCells.LoadOptions(AsposeCells.LoadFormat.Xlsx);
loadOptions.setLoadFilter(new AsposeCells.LoadFilter(AsposeCells.LoadDataFilterOptions.All & ~AsposeCells.LoadDataFilterOptions.Chart));
// Create workbook object from sample excel file using load options
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "sampleFilterChars.xlsx"), loadOptions);
// Save the output in pdf format
workbook.save(outputDir + "sampleFilterChars_out.pdf", AsposeCells.SaveFormat.Pdf);