Interface IOleObject
Represents the OLE object in the PowerPoint presentation.
Inherited Members
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IOleObject : IShape, ISlideItem
Properties
DisplayAsIcon
Gets or sets a value indicating whether the OLE object is displayed as an icon or content.
Declaration
bool DisplayAsIcon { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the OLE object is displayed as an icon; otherwise, false. |
Remarks
Initially Presentation library generated documents display the icon (given image) in place of the embedded OLE instance.
By setting the DisplayAsIcon property to true, the icon is not updated after opening or editing the OLE instance by using Microsoft PowerPoint.
However, setting the DisplayAsIcon property to false enables the Presentation document to update the icons dynamically with the content after opening or editing the OLE instance.
Examples
//Create new instance of PowerPoint presentation.
IPresentation pptxDoc = Presentation.Create();
//Add slide with blank layout to presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Get the excel file as stream
Stream excelStream = File.Open("OleTemplate.xlsx", FileMode.Open);
//Image to be displayed, This can be any image
Stream imageStream = File.Open("OlePicture.png", FileMode.Open);
//Add an OLE object to the slide
IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Excel.Sheet.12", excelStream);
//Set size and position of the OLE object
oleObject.Left = 10;
oleObject.Top = 10;
oleObject.Width = 400;
oleObject.Height = 300;
//Set DisplayAsIcon as true, to open the embedded document in separate (default) application.
oleObject.DisplayAsIcon = true;
//Save the presentation
pptxDoc.Save("OleObjectSample.pptx");
//Close the presentation
pptxDoc.Close();
'Create New instance of PowerPoint presentation.
Dim pptxDoc As IPresentation = Presentation.Create
'Add slide with blank layout to presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Get the excel file as stream
Dim excelStream As Stream = File.Open("OleTemplate.xlsx", FileMode.Open)
'Image to be displayed, This can be any image
Dim imageStream As Stream = File.Open("OlePicture.png", FileMode.Open)
'Add an OLE object to the slide
Dim oleObject As IOleObject = slide.Shapes.AddOleObject(imageStream, "Excel.Sheet.12", excelStream)
'Set size and position of the OLE object
oleObject.Left = 10
oleObject.Top = 10
oleObject.Width = 400
oleObject.Height = 300
'Set DisplayAsIcon as true, to open the embedded document in separate (default) application.
oleObject.DisplayAsIcon = True
'Save the presentation
pptxDoc.Save("OleObjectSample.pptx")
'Close the presentation
pptxDoc.Close()
FileName
Gets the file name of embedded or linked OLE object.
Declaration
string FileName { get; }
Property Value
Type | Description |
---|---|
System.String | The string that specifies the file name of the OLE object. |
Examples
//Load a PowerPoint presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide from the presentation
ISlide slide = presentation.Slides[0];
//Get the oleObject from the slide
IOleObject oleObject = (IShape)slide.Shapes[0] as IOleObject;
//Gets the embedded OLE object data
byte[] array = oleObject.ObjectData;
//Gets the file name of OLE object
string fileName = oleObject.FileName;
//Save the extracted OLE data into file system.
MemoryStream memoryStream = new MemoryStream(array);
FileStream fileStream = File.Create(fileName);
memoryStream.CopyTo(fileStream);
memoryStream.Dispose();
fileStream.Dispose();
//Close the Presentation
presentation.Close();
'Load a PowerPoint presentation
Dim presentation As IPresentation = Syncfusion.Presentation.Presentation.Open("Sample.pptx")
'Get the first slide from the presentation
Dim slide As ISlide = presentation.Slides(0)
'Get the oleObject from the slide
Dim oleObject As IOleObject = CType(CType(slide.Shapes(0), IOleObject), IShape)
'Gets the embedded OLE object data
Dim array() As Byte = oleObject.ObjectData
'Gets the file name of OLE object
Dim fileName As string = oleObject.FileName
'Save the extracted OLE data into file system.
Dim memoryStream As MemoryStream = New MemoryStream(array)
Dim fileStream As FileStream = File.Create(fileName)
memoryStream.CopyTo(fileStream)
memoryStream.Dispose
fileStream.Dispose
'Close the Presentation
presentation.Close()
ImageData
Gets the image data for the specified OLE object.
Declaration
byte[] ImageData { get; }
Property Value
Type | Description |
---|---|
System.Byte[] | The byte array that specifies the OLE image data. |
Examples
//Load a PowerPoint presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide from the presentation
ISlide slide = presentation.Slides[0];
//Get the oleObject from the slide
IOleObject oleObject = (IShape)slide.Shapes[0] as IOleObject;
//Gets the image data of embedded Ole Object.
byte[] array = oleObject.ImageData;
//Save the extracted OLE image data into file system.
MemoryStream memoryStream = new MemoryStream(array);
FileStream fileStream = File.Create("OleImage.png");
memoryStream.CopyTo(fileStream);
memoryStream.Dispose();
fileStream.Dispose();
//Close the Presentation
presentation.Close();
'Load a PowerPoint presentation
Dim presentation As IPresentation = Syncfusion.Presentation.Presentation.Open("Sample.pptx")
'Get the first slide from the presentation
Dim slide As ISlide = presentation.Slides(0)
'Get the oleObject from the slide
Dim oleObject As IOleObject = CType(CType(slide.Shapes(0), IOleObject), IShape)
'Gets the image data of embedded Ole Object.
Dim array() As Byte = oleObject.ImageData
'Save the extracted OLE image data into file system.
Dim memoryStream As MemoryStream = New MemoryStream(array)
Dim fileStream As FileStream = File.Create("OleImage.png")
memoryStream.CopyTo(fileStream)
memoryStream.Dispose
fileStream.Dispose
'Close the Presentation
presentation.Close()
LinkPath
Gets the linked path for the specified OLE object.
Declaration
string LinkPath { get; }
Property Value
Type | Description |
---|---|
System.String | The string that specifies the OLE object link address. |
Examples
//Load a PowerPoint presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide from the presentation
ISlide slide = presentation.Slides[0];
//Get the oleObject from the slide
IOleObject oleObject = (IShape)slide.Shapes[0] as IOleObject;
//Gets the OLE object linked path
string objectPath = oleObject.LinkPath;
//Close the Presentation
presentation.Close();
'Load a PowerPoint presentation
Dim presentation As IPresentation = Syncfusion.Presentation.Presentation.Open("Sample.pptx")
'Get the first slide from the presentation
Dim slide As ISlide = presentation.Slides(0)
'Get the oleObject from the slide
Dim oleObject As IOleObject = CType(CType(slide.Shapes(0), IOleObject), IShape)
'Gets the OLE object linked path
Dim objectPath As String = oleObject.LinkPath
'Close the Presentation
presentation.Close()
ObjectData
Gets the embedded file data for the specified OLE object.
Declaration
byte[] ObjectData { get; }
Property Value
Type | Description |
---|---|
System.Byte[] | The byte array that specifies the embedded file data. |
Examples
//Load a PowerPoint presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide from the presentation
ISlide slide = presentation.Slides[0];
//Get the oleObject from the slide
IOleObject oleObject = (IShape)slide.Shapes[0] as IOleObject;
//Gets the embedded OLE object data
byte[] array = oleObject.ObjectData;
//Save the extracted OLE data into file system.
MemoryStream memoryStream = new MemoryStream(array);
FileStream fileStream = File.Create("OleFile.docx");
memoryStream.CopyTo(fileStream);
memoryStream.Dispose();
fileStream.Dispose();
//Close the Presentation
presentation.Close();
'Load a PowerPoint presentation
Dim presentation As IPresentation = Syncfusion.Presentation.Presentation.Open("Sample.pptx")
'Get the first slide from the presentation
Dim slide As ISlide = presentation.Slides(0)
'Get the oleObject from the slide
Dim oleObject As IOleObject = CType(CType(slide.Shapes(0), IOleObject), IShape)
'Gets the embedded OLE object data
Dim array() As Byte = oleObject.ObjectData
'Save the extracted OLE data into file system.
Dim memoryStream As MemoryStream = New MemoryStream(array)
Dim fileStream As FileStream = File.Create("OleFile.docx")
memoryStream.CopyTo(fileStream)
memoryStream.Dispose
fileStream.Dispose
'Close the Presentation
presentation.Close()
ProgID
Gets the programmatic identifier (ProgID) for the specified OLE object.
Declaration
string ProgID { get; }
Property Value
Type | Description |
---|---|
System.String | The string that specifies the type of the OLE object. |
Examples
//Load a PowerPoint presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Get the first slide from the presentation
ISlide slide = presentation.Slides[0];
//Get the oleObject from the slide
IOleObject oleObject = (IShape)slide.Shapes[0] as IOleObject;
//Gets the embedded OLE object type
string objectType = oleObject.ProgID;
//Close the Presentation
presentation.Close();
'Load a PowerPoint presentation
Dim presentation As IPresentation = Syncfusion.Presentation.Presentation.Open("Sample.pptx")
'Get the first slide from the presentation
Dim slide As ISlide = presentation.Slides(0)
'Get the oleObject from the slide
Dim oleObject As IOleObject = CType(CType(slide.Shapes(0), IOleObject), IShape)
'Gets the embedded OLE object type
Dim objectType As String = oleObject.ProgID
'Close the Presentation
presentation.Close()