OLE Objekt automatisch über Microsoft Excel mit Aspose.Cells aktualisieren
Contents
[
Hide
]
Aspose.Cells bietet die Eigenschaft OleObject.AutoLoad, um das OLE-Objekt zu aktualisieren, wenn die Excel-Datei in Microsoft Excel geöffnet wird. Aufgrund dieser Eigenschaft wird das OLE-Objekt das korrekte OLE-Bild anzeigen, das von Microsoft Excel generiert wurde.
Der folgende Beispielcode lädt die Beispieldatei Excel, die ein nicht-reales OLE-Bild enthält. Das OLE-Objekt ist tatsächlich ein Microsoft-Word-Dokument, aber die Beispieldatei Excel zeigt stattdessen das Tierbild an. Wenn Sie jedoch die Ausgabedatei Excel öffnen, sehen Sie, dass Microsoft Excel das korrekte OLE-Bild anzeigt.
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create workbook object from your sample excel file | |
Workbook wb = new Workbook(dataDir + "sample.xlsx"); | |
// Access first worksheet | |
Worksheet sheet = wb.Worksheets[0]; | |
// Set auto load property of first ole object to true | |
sheet.OleObjects[0].AutoLoad = true; | |
// Save the worbook in xlsx format | |
wb.Save(dataDir + "RefreshOLEObjects_out.xlsx", SaveFormat.Xlsx); |