Interface IOleObjects
Represents the Ole objects shape collections.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public interface IOleObjects : IList<IOleObject>, ICollection<IOleObject>, IEnumerable<IOleObject>, IEnumerable
Methods
Add(String, Image, OleLinkType)
Adds new ole object to the collection.
Declaration
IOleObject Add(string fileName, Image image, OleLinkType linkType)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | File name. |
System.Drawing.Image | image | File image. |
OleLinkType | linkType | Link type. |
Returns
Type | Description |
---|---|
IOleObject | Returns a Ole object |
Remarks
This method is not supported in UWP, ASP.NET Core and Xamarin.
Examples
The following code illustrates how to add an IListObject to the IListObjects collection.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Create image stream
System.Drawing.Image image = System.Drawing.Image.FromFile("image.png");
//Add ole object
IOleObject oleObject = worksheet.OleObjects.Add("Shapes.xlsx", image, OleLinkType.Embed);
//Save and dispose
workbook.SaveAs("OLEObjects.xlsx");
workbook.Close();
}