刷新链接形状的值

例子

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

待办事项:图片_替代_文本

您可以下载源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);