Actualiser automatiquement l objet OLE
Le code d’exemple suivant charge le fichier Excel d’exemple qui contient une image OLE non réelle. L’objet OLE est en fait un document Microsoft Word mais le fichier Excel d’exemple affiche l’image d’animal au lieu de l’image de Microsoft Word. Mais si vous ouvrez le fichier Excel de sortie, vous verrez que Microsoft Excel affiche l’image OLE correcte.
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) |