Hyperlinks im Bereich abrufen
Contents
[
Hide
]
Hyperlinks im Bereich abrufen
Die Range Klasse bietet eine getHyperlinks() Methode, die alle Hyperlinks im ausgewählten Bereich zurückgibt. Sie können den Hyperlink auch löschen, indem Sie die Hyperlink.delete() Methode aufrufen.
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 path = require("path"); | |
const AsposeCells = require("aspose.cells.node"); | |
// The path to the documents directory. | |
const sourceDir = path.join(__dirname, "data"); | |
const outputDir = path.join(__dirname, "output"); | |
// Instantiate a Workbook object | |
// Open an Excel file | |
const workbook = new AsposeCells.Workbook(`${sourceDir}/HyperlinksSample.xlsx`); | |
// Get the first (default) worksheet | |
const worksheet = workbook.getWorksheets().get(0); | |
// Create a range A2:B3 | |
const range = worksheet.getCells().createRange("A2", "B3"); | |
// Get Hyperlinks in range | |
const hyperlinks = range.getHyperlinks(); | |
hyperlinks.forEach(link => { | |
console.log(`${link.getArea()} : ${link.getAddress()}`); | |
// To delete the link, use the Hyperlink.Delete() method. | |
link.delete(); | |
}); | |
workbook.save(`${outputDir}/HyperlinksSample_out.xlsx`); |