Zellen mit bestimmtem Stil finden

Contents
[ ]

Der Code in diesem Beispiel sucht alle Zellen, die denselben Stil wie die Zelle A1 haben. Nachdem der Code ausgeführt wurde, enthalten alle Zellen, die denselben Stil wie A1 haben, den Text “Gefunden”.

const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "TestBook.xlsx");
const workbook = new AsposeCells.Workbook(filePath);
const worksheet = workbook.getWorksheets().get(0);
// Access the style of cell A1
const style = worksheet.getCells().get("A1").getStyle();
// Specify the style for searching
const options = new AsposeCells.FindOptions();
options.setStyle(style);
let nextCell = null;
do {
// Find the cell that has a style of cell A1
nextCell = worksheet.getCells().find(null, nextCell, options);
if (nextCell === null) break;
// Change the text of the cell
nextCell.putValue("Found");
} while (true);
const outputPath = path.join(dataDir, "output.out.xlsx");
workbook.save(outputPath);