Aggiorna automaticamente l'oggetto OLE tramite Microsoft Excel utilizzando Aspose.Cells
Contents
[
Hide
]
Aspose.Cells fornisce ilOleObject.AutoLoad property per aggiornare l’oggetto OLE quando il file excel viene aperto in Microsoft Excel. A causa di questa proprietà, l’oggetto OLE visualizzerà l’immagine OLE corretta generata da Microsoft Excel.
Aggiorna automaticamente l’oggetto OLE tramite Microsoft Excel utilizzando Aspose.Cells
Il codice di esempio seguente carica il filefile excel di esempio che ha un’immagine OLE non reale. L’oggetto OLE è in realtà un documento Word Microsoft, ma il file Excel di esempio mostra l’immagine dell’animale anziché l’immagine Word Microsoft. Ma se apri il filefile excel di output, vedrai Microsoft Excel visualizza l’immagine OLE corretta.
Lo screenshot seguente mostra come il filefile excel di esempio appare quando viene aperto in Microsoft Excel.
Lo screenshot seguente mostra come il filefile excel di output appare quando viene aperto in Microsoft Excel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |