I have this EPPlus code to place a bitmap on an Excel spreadsheet at column 5/E, row 1:
using (var package = new ExcelPackage(file))
{
. . .
AddImage(locationWorksheet, 1, 5, imgPath);
. . .
}
private void AddImage(ExcelWorksheet oSheet, int rowIndex, int colIndex, string imagePath)
{
Bitmap image = new Bitmap(imagePath);
{
var excelImage = oSheet.Drawings.AddPicture("PRO*ACT Logo", image);
excelImage.From.Column = colIndex;
excelImage.From.Row = rowIndex;
excelImage.SetSize(108, 84);
}
}
The image is a .png file, with the dimensions shown (108X84).
Although the image should display at tghe intersection of row 1 and column 5, it's actually more like row 2 and column 6:
Why, and how can I rectify this?
Note: Excel column and row indexes are 1-based (not 0).