Cambiar el tipo de destino del enlace HTML con Node.js mediante C++
Aspose.Cells te permite cambiar el tipo de destino del enlace HTML. El enlace HTML luce así
<a href="http://www.aspose.com/" target="_self">
Como puedes ver, el atributo target en el enlace HTML anterior es _self. Puedes controlar este atributo target usando la propiedad HtmlSaveOptions.getLinkTargetType(). Esta propiedad toma el enum HtmlLinkTargetType que tiene los siguientes valores.
- HtmlLinkTargetType.Blank
- HtmlLinkTargetType.Parent
- HtmlLinkTargetType.Self
- HtmlLinkTargetType.Top
El siguiente código ilustra el uso de la propiedad HtmlSaveOptions.getLinkTargetType(). Cambia el tipo de destino del enlace a blank. Por defecto, es 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}`);