تحديث قيم الأشكال المرتبطة

مثال

اللقطة الملتقطة التالية تظهر ملف Excel المصدر المستخدم في الكود العيني أدناه. يحتوي على صورة مرتبطة مرتبطة بخلايا من A1 إلى E4. سنقوم بتغيير قيمة الخلية B4 باستخدام Aspose.Cells ومن ثم استدعاء الطريقة Worksheet.Shapes.UpdateSelectedValue() لتحديث قيمة الصورة وحفظها في تنسيق PDF.

todo:image_alt_text

يمكنك تنزيل الملف الأصلي ملف الإكسل المصدر و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);