Refresh Values of Linked Shapes with Node.js via C++
Example
The following screenshot shows the source Excel file used in the sample code below. It has a linked picture linked to cells A1 to E4. We will change the value of cell B4 with Aspose.Cells and then call ShapeCollection.updateSelectedValue() method to refresh the value of the picture and save it in PDF format.
You can download the source Excel file and the output PDF from the given links.
Node.js code to refresh the values of linked shapes
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);