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

مثال

تظهر اللقطة الشاشة التالية ملف Excel المصدر المستخدم في رمز العينة أدناه. لديها صورة 1 مرتبطة بالخلية A1. سنقوم بتغيير قيمة الخلية A1 بواسطة Aspose.Cells، ثم نقوم بالاتصال بـ Worksheet.getShapes().updateSelectedValue() لتحديث قيمة صورة 1 وحفظها في تنسيق PDF.

todo:image_alt_text

يمكنك تنزيل ملف Excel المصدر و ملف PDF الناتج من الروابط المعطاة.

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

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(RefreshValuesOfLinkedShapes.class);
// Create workbook from source file
Workbook workbook = new Workbook(dataDir + "LinkedShape.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Change the value of cell A1
Cell cell = worksheet.getCells().get("A1");
cell.putValue(100);
// Update the value of the Linked Picture which is linked to cell A1
worksheet.getShapes().updateSelectedValue();
// Save the workbook in pdf format
workbook.save(dataDir + "output.pdf", SaveFormat.PDF);