刷新链接形状的值

示例

以下截图显示了下面示例代码中使用的源Excel文件。其有一个链接图片链接到单元格A1到E4。我们将更改单元格B4的值用Aspose.Cells,然后调用Worksheet.Shapes.UpdateSelectedValue()方法刷新图片的值并将其保存为PDF格式。

todo:image_alt_text

您可以从以下链接下载源Excel文件和输出PDF。

C#代码来刷新链接形状的值

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Create workbook from source file
Workbook workbook = new Workbook(sourceDir + "sampleRefreshValueOfLinkedShapes.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Change the value of cell B4
Cell cell = worksheet.Cells["B4"];
cell.PutValue(100);
// Update the value of the Linked Picture which is linked to cell B4
worksheet.Shapes.UpdateSelectedValue();
// Save the workbook in PDF format
workbook.Save(outputDir + "outputRefreshValueOfLinkedShapes.pdf", SaveFormat.Pdf);