Aktualisieren Sie das OLE-Objekt automatisch über Microsoft Excel mit Aspose.Cells
Contents
[
Hide
]
Aspose.Cells bietet dieOleObject.AutoLoad -Eigenschaft zum Aktualisieren des OLE-Objekts, wenn die Excel-Datei in Microsoft Excel geöffnet wird. Aufgrund dieser Eigenschaft zeigt das OLE-Objekt das richtige OLE-Bild an, das von Microsoft Excel generiert wurde.
Aktualisieren Sie das OLE-Objekt automatisch über Microsoft Excel mit Aspose.Cells
Der folgende Beispielcode lädt dieExcel-Beispieldatei die ein nicht echtes OLE-Bild hat. Das OLE-Objekt ist eigentlich ein Microsoft-Word-Dokument, aber die Excel-Beispieldatei zeigt das Tierbild anstelle des Microsoft-Word-Bilds. Aber wenn Sie die öffnenExcel-Datei ausgeben, sehen Sie Microsoft Excel zeigt das richtige OLE-Bild an.
Der folgende Screenshot zeigt, wie dieExcel-Beispieldatei sieht aus, wenn es in Microsoft Excel geöffnet wird.
Der folgende Screenshot zeigt, wie dieExcel-Datei ausgeben sieht aus, wenn es in Microsoft Excel geöffnet wird.
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); |