This project has moved. For the latest updates, please go here.
1
Vote

Excel Workbook Image

description

I am trying to add an image to the worksheet but i am getting a error at the following line

picture = ws.Drawings.AddPicture("profile" + rowIndex.ToString() + columnIndex.ToString(), image );

below is teh exception that is trown.
Kindly advise.

Exception:
System.ArgumentException: Column number out of bounds
at OfficeOpenXml.ExcelWorksheet.Column (System.Int32 col) [0x00012] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at OfficeOpenXml.Drawing.ExcelDrawing.GetColumnWidth (System.Int32 col) [0x00027] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at OfficeOpenXml.Drawing.ExcelDrawing.SetPixelWidth (System.Int32 pixels, System.Single dpi) [0x000d6] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at OfficeOpenXml.Drawing.ExcelPicture.SetPosDefaults (System.Drawing.Image image) [0x00014] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at OfficeOpenXml.Drawing.ExcelPicture..ctor (OfficeOpenXml.Drawing.ExcelDrawings drawings, System.Xml.XmlNode node, System.Drawing.Image image, System.Uri hyperlink) [0x000cb] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at OfficeOpenXml.Drawing.ExcelDrawings.AddPicture (System.String Name, System.Drawing.Image image, System.Uri Hyperlink) [0x00033] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at OfficeOpenXml.Drawing.ExcelDrawings.AddPicture (System.String Name, System.Drawing.Image image) [0x00000] in <4bd0d26e3ed04f6aad4312cd111b2c4d>:0
at ElecBnd.VotersList.AddImage (OfficeOpenXml.ExcelWorksheet ws, System.Int32 rowIndex, System.Int32 columnIndex, System.Drawing.Image image) [0x0004a]

comments