Modifica il tipo di destinazione del link HTML con Node.js tramite C++
Aspose.Cells ti permette di cambiare il tipo di destinazione del link HTML. Il link HTML appare così
<a href="http://www.aspose.com/" target="_self">
Come puoi vedere, l’attributo target nel link HTML sopra è _self. Puoi controllare questo attributo target usando la proprietà HtmlSaveOptions.getLinkTargetType(). Questa proprietà accetta l’enumerazione HtmlLinkTargetType, che ha i seguenti valori.
- HtmlLinkTargetType.Blank
- HtmlLinkTargetType.Parent
- HtmlLinkTargetType.Self
- HtmlLinkTargetType.Top
Il codice seguente illustra l’uso della proprietà HtmlSaveOptions.getLinkTargetType(). Cambia il tipo di destinazione del link in blank. Di default, è parent.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const inputPath = path.join(dataDir, "Sample1.xlsx");
const outputPath = path.join(dataDir, "Output.out.html");
const workbook = new AsposeCells.Workbook(inputPath);
const opts = new AsposeCells.HtmlSaveOptions();
opts.setLinkTargetType(AsposeCells.HtmlLinkTargetType.Self);
workbook.save(outputPath, opts);
console.log(`File saved: ${outputPath}`);