I'm creating excel document from controller like this:
ExcelExport exp = new ExcelExport();
var DataSource = db.recognitions.Include(c => c.CaptureSource).ToList();
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
sheet.FirstVisibleRow = 0;
sheet.Range["A1"].Text = "Capture source";
sheet.Range["B1"].Text = "Date / time";
sheet.Range["C1"].Text = "Plate text";
sheet.Range["D1"].Text = "Country assumed";
sheet.Range["E1"].Text = "Confidence level";
sheet.Range["F1"].Text = "Plate image";
int row = 2;
foreach (var item in DataSource)
{
sheet.Range[row, 1].Text = item.CaptureSource.name;
sheet.Range[row, 2].Text = item.date.ToShortDateString();
sheet.Range[row, 3].Text = item.plate_text;
sheet.Range[row, 4].Text = item.country_assumed;
sheet.Range[row, 5].Text = item.confidence_level;
sheet.Range[row, 6].Text = item.plate_image_url;
row++;
}
try
{
return excelEngine.SaveAsActionResult(workbook, "SpreadSheet.xls", HttpContext.ApplicationInstance.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel97);
}
catch (Exception)
{
}
workbook.Close();
excelEngine.Dispose();
return View("Index");
and it is working file.
Now, I want to show image from item.plate_image_url in column 6 for all rows. So, every row has its own picture. I can add picture with sheet.Shapes.AddPicture(item.plate_image_url), but how can I place that image centered in cell [row, 6] ?
Thanks!