用Node.js和C++从网页地址插入链接图片

使用Microsoft Excel

在Microsoft Excel中(例如2007):

  1. 单击插入菜单,然后选择图片
  2. 在插入图片对话框中指定图片的Web地址。

使用 Aspose.Cells for Node.js via C++

Aspose.Cells for Node.js via C++支持使用ShapeCollection.addLinkedPicture(upperLeftRow, upperLeftColumn, heightPixels, widthPixels, sourceFullName)添加链接的图片。该方法返回一个Picture对象。

以下示例展示了如何将来自Web地址的链接图片添加到工作表中。

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiate a new Workbook.
const workbook = new AsposeCells.Workbook();
// Insert a linked picture (from Web Address) to B2 Cell.
const pic = workbook.getWorksheets().get(0).getShapes().addLinkedPicture(1, 1, 100, 100, "http://www.aspose.com/Images/aspose-logo.jpg");
// Set the height and width of the inserted image.
pic.setHeightInch(1.04);
pic.setWidthInch(2.6);
// Save the Excel file.
workbook.save(path.join(dataDir, "outLinkedPicture.out.xlsx"));