Node.jsとC++を用いたリンク済みシェイプの値の更新

以下のスクリーンショットは、サンプルコードで使用されているソースExcelファイルを示しています。このファイルには、セルA1からE4にリンクされた画像があります。Aspose.Cellsを使ってセルB4の値を変更し、その後ShapeCollection.updateSelectedValue()メソッドを呼び出して画像の値を更新し、PDF形式で保存します。

todo:image_alt_text

指定されたリンク済みExcelファイル(ソースExcelファイル)と出力PDF(出力PDF)はリンクからダウンロード可能です。

リンクされたシェイプの値を更新するNode.jsコード

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

// Source directory
const sourceDir = path.join(__dirname, "data");
// Output directory
const outputDir = path.join(__dirname, "output");

// Create workbook from source file
const workbook = new AsposeCells.Workbook(path.join(sourceDir, "sampleRefreshValueOfLinkedShapes.xlsx"));

// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);

// Change the value of cell B4
const cell = worksheet.getCells().get("B4");
cell.putValue(100);

// Update the value of the Linked Picture which is linked to cell B4
worksheet.getShapes().updateSelectedValue();

// Save the workbook in PDF format
workbook.save(path.join(outputDir, "outputRefreshValueOfLinkedShapes.pdf"), AsposeCells.SaveFormat.Pdf);