Insérer une image liée depuis une adresse Web avec Node.js via C++

Utilisation de Microsoft Excel

Dans Microsoft Excel (par exemple 2007) :

  1. Cliquez sur le menu Insérer et sélectionnez Image.
  2. Spécifiez l’adresse web de l’image dans la boîte de dialogue Insérer une image.

Utilisation de Aspose.Cells for Node.js via C++

Aspose.Cells for Node.js via C++ supporte l’ajout d’une image liée en utilisant ShapeCollection.addLinkedPicture(upperLeftRow, upperLeftColumn, heightPixels, widthPixels, sourceFullName). La méthode retourne un objet Picture.

L’exemple suivant montre comment ajouter une image liée depuis une adresse web dans une feuille de calcul.

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"));