Syncfusion.XlsIO.Base
Example 


File name.
File image.
Link type.

Add Method (IOleObjects)

Adds new ole object to the collection.
Syntax
'Declaration
 
Function Add( _
   ByVal fileName As String, _
   ByVal image As Image, _
   ByVal linkType As OleLinkType _
) As IOleObject
'Usage
 
Dim instance As IOleObjects
Dim fileName As String
Dim image As Image
Dim linkType As OleLinkType
Dim value As IOleObject
 
value = instance.Add(fileName, image, linkType)

Parameters

fileName
File name.
image
File image.
linkType
Link type.

Return Value

Returns a Ole object
Remarks
This method is not supported in UWP, ASP.NET Core and Xamarin.
Example
The following code illustrates how to add an IListObject to the IListObjects collection.
using Syncfusion.XlsIO;
using System.Drawing;
            
class Program
{
    static void Main()
    {
        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
            Image image = 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();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also