自动刷新 OLE 对象

Contents
[ ]

以下样本代码加载了包含非真实OLE图像的 样本excel文件。OLE对象实际上是一个Microsoft Word文档,但样本excel文件显示的是动物图像,而不是Microsoft Word图像。但是,如果打开 输出excel文件,您将看到Microsoft Excel显示了正确的OLE图像。

from aspose.cells import SaveFormat, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Create workbook object from your sample excel file
wb = Workbook(dataDir + "sample.xlsx")
# Access first worksheet
sheet = wb.worksheets[0]
# Set auto load property of first ole object to true
sheet.ole_objects[0].auto_load = True
# Save the worbook in xlsx format
wb.save(dataDir + "RefreshOLEObjects_out.xlsx", SaveFormat.XLSX)