قم بتحديث كائن OLE تلقائيًا عبر Microsoft Excel باستخدام Aspose.Cells

قم بتحديث كائن OLE تلقائيًا عبر Microsoft Excel باستخدام Aspose.Cells

يقوم نموذج التعليمات البرمجية التالي بتحميل ملفنموذج ملف اكسل الذي يحتوي على صورة OLE غير حقيقية. كائن OLE هو في الواقع مستند Word Microsoft لكن نموذج ملف Excel يعرض صورة الحيوان بدلاً من Microsoft Word image. ولكن إذا قمت بفتح ملفملف اكسل الناتج، سترى Microsoft يعرض Excel صورة OLE الصحيحة.

توضح لقطة الشاشة التالية كيف أن ملفنموذج ملف اكسل يبدو عند فتحه في Microsoft Excel.

ما يجب القيام به: image_بديل_نص

توضح لقطة الشاشة التالية كيف أن ملفملف اكسل الناتج يبدو عند فتحه في Microsoft Excel.

ما يجب القيام به: image_بديل_نص

// 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(AutomaticallyrefreshOLEobject.class);
// Create workbook object from your sample excel file
Workbook wb = new Workbook(dataDir + "sample.xlsx");
// Access first worksheet
Worksheet sheet = wb.getWorksheets().get(0);
// Set auto load property of first ole object to true
sheet.getOleObjects().get(0).setAutoLoad(true);
// Save the worbook in xlsx format
wb.save(dataDir + "output.xlsx", SaveFormat.XLSX);