//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; // Place the same picture to two range System.IO.Stream stream = this.GetResourceStream("puffins.jpg"); IShape smallPicture = worksheet.Shapes.AddPicture(stream, ImageType.JPG, worksheet.Range["B2:B4"]); IShape bigPicture = worksheet.Shapes.AddPicture(stream, ImageType.JPG, worksheet.Range["D4:F12"]); worksheet.Shapes.AddConnector(ConnectorType.Straight, worksheet.Range["C2:F3"]); worksheet.Shapes.AddConnector(ConnectorType.Straight, worksheet.Range["B5:C12"]);
' Create a new Workbook Dim workbook As New Workbook Dim worksheet = workbook.Worksheets(0) ' Place the same picture to two range Dim stream = GetResourceStream("puffins.jpg") Dim smallPicture = worksheet.Shapes.AddPicture(stream, ImageType.JPG, worksheet.Range("B2:B4")) Dim bigPicture = worksheet.Shapes.AddPicture(stream, ImageType.JPG, worksheet.Range("D4:F12")) worksheet.Shapes.AddConnector(ConnectorType.Straight, worksheet.Range("C2:F3")) worksheet.Shapes.AddConnector(ConnectorType.Straight, worksheet.Range("B3:C12")) ' save to an excel file workbook.Save("AddPictureToRange.xlsx")