Get or Set the Class Identifier of the Embedded OLE Object
Possible Usage Scenarios
Aspose.Cells provides the OleObject.ClassIdentifier property which you can use to get or set the class identifier of embedded ole object. Ole Object Class Identifiers are actually GUIDs i.e Globally Unique Identifiers. GUID is always 16-bytes long, therefore Class Identifiers are also 16-bytes long. They are often found inside the Windows Registry and provide information to host application about how to open embedded ole object containing various embedded resources inside the client application.
Get or Set the Class Identifier of the Embedded OLE Object
The following screenshot shows the Ole Object Class Identifier i.e GUID which has been read from the sample excel file containing the embedded PowerPoint ole object.
Sample Code
Please see the following sample code executed with sample excel file and its console output which prints the Class Identifier of Ole Object i.e GUID. The printed GUID is exactly same as shown inside the screenshot.
// 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); | |
// Load your sample workbook which contains embedded PowerPoint ole object | |
Workbook wb = new Workbook(dataDir + "sample.xls"); | |
// Access its first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
// Access first ole object inside the worksheet | |
OleObject oleObj = ws.OleObjects[0]; | |
// Convert 16-bytes array into GUID | |
Guid guid = new Guid(oleObj.ClassIdentifier); | |
// Print the GUID | |
Console.WriteLine(guid.ToString().ToUpper()); |
Console Output
This is the console output of the above sample code when executed with the sample excel file.
DC020317-E6E2-4A62-B9FA-B3EFE16626F4