Parameters
- img
- The image contained in the new XLPictureShape.
- rc
- The rectangle that specifies the image size and position with respect to the cell, in twips.
// get sheet and cell XLSheet sheet = c1ExcelBook1.Sheets[0]; XLCell cell = sheet[row, col]; // calculate cell size to align picture Rectangle rc = new Rectangle(0, 0 sheet.Columns[col].Width, sheet.Rows[row].Height); // add 60 twip edge rc.Inflate(-60, -60); // build XLPictureShape XLPictureShape pic = new XLPictureShape(image, rc); // assign XLPictureShape to cell cell.Value = pic;