Accedi e modifica l'etichetta di visualizzazione dell'oggetto Ole collegato
Contents
[
Hide
]
Possibili scenari di utilizzo
Microsoft Excel consente di modificare l’etichetta di visualizzazione dell’Oggetto Ole come mostrato nello screenshot seguente. Puoi anche accedere o modificare l’etichetta di visualizzazione dell’oggetto Ole utilizzando le API Aspose.Cells con ilOleObject.Labelproprietà.
Accedi e modifica l’etichetta di visualizzazione dell’oggetto Ole collegato
Si prega di vedere il seguente codice di esempio, carica il fileesempio di file Excelche contiene l’oggetto Ole. Il codice accede all’oggetto Ole e cambia la sua etichetta da API di esempio ad API Aspose. Si prega di consultare l’output della console fornito di seguito che mostra l’effetto del codice di esempio sul file Excel di esempio per un riferimento.
Codice d’esempio
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 | |
//Load the sample Excel file | |
Workbook wb = new Workbook("sampleAccessAndModifyLabelOfOleObject.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
//Access first Ole Object | |
Aspose.Cells.Drawing.OleObject oleObject = ws.OleObjects[0]; | |
//Display the Label of the Ole Object | |
Console.WriteLine("Ole Object Label - Before: " + oleObject.Label); | |
//Modify the Label of the Ole Object | |
oleObject.Label = "Aspose APIs"; | |
//Save workbook to memory stream | |
MemoryStream ms = new MemoryStream(); | |
wb.Save(ms, SaveFormat.Xlsx); | |
//Set the workbook reference to null | |
wb = null; | |
//Load workbook from memory stream | |
wb = new Workbook(ms); | |
//Access first worksheet | |
ws = wb.Worksheets[0]; | |
//Access first Ole Object | |
oleObject = ws.OleObjects[0]; | |
//Display the Label of the Ole Object that has been modified earlier | |
Console.WriteLine("Ole Object Label - After: " + oleObject.Label); |
Uscita console
Ole Object Label - Before: Sample APIs
Ole Object Label - After: Aspose APIs