Refresh Values of Linked Shapes

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 for Python via .NET and then call Worksheet.Shapes.update_selected_value() method to refresh the value of the picture and save it in PDF format.

todo:image_alt_text

You can download the source Excel file and the output PDF from the given links.

C# code to refresh the values of linked shapes

from aspose.cells import SaveFormat, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Source directory
sourceDir = RunExamples.Get_SourceDirectory()
# Output directory
outputDir = RunExamples.Get_OutputDirectory()
# Create workbook from source file
workbook = Workbook(sourceDir + "sampleRefreshValueOfLinkedShapes.xlsx")
# Access first worksheet
worksheet = workbook.worksheets[0]
# Change the value of cell B4
cell = worksheet.cells.get("B4")
cell.put_value(100)
# Update the value of the Linked Picture which is linked to cell B4
worksheet.shapes.update_selected_value()
# Save the workbook in PDF format
workbook.save(outputDir + "outputRefreshValueOfLinkedShapes.pdf", SaveFormat.PDF)