c# - EPPlus Excel AddPicture error 'Column number out of bounds' -
i have following code:
the line 'excelimage' initialization throws exception: column number out of bounds. solution of problem?
var range2 = worksheet.cells ["a" + limiter.tostring ()]; range2.value = tokengood.id; //take json-array worksheet.row (limiter).height = 70; //'limiter' row iterator worksheet.column (1).width = 10; bitmap img = new bitmap(image.fromfile (pic_filename)); officeopenxml.drawing.excelpicture excelimage = worksheet.drawings.addpicture ("random_string", img); //error line excelimage.from.column = 3; excelimage.from.row = limiter; excelimage.setsize (60, 60);
this seems bug in current (4.0.5) epplus. though current version has been released recently, backlog of open issues on codeplex huge, don't see approaching fixed release...
i solved downloading source, manually correcting 4 rows in epplus/drawing/exceldrawingbase.cs , recompiling.
the rows 513, 515 (both in setpixelheight(int, float)
) , 540, 542 (in setpixelwitdh(int, float)
).
i changed occurrences of from.column
or from.row
in 2 lines math.max(from.column, 0)
, math.max(from.row, 0)
.
the problem here from
property object has somehow not been initialized, , values of from.row
, from.column
set int.minvalue
- not valid column/row index, may guess.
i've been looking workarounds don't require edit source code, couldn't find any: hope helps.
Comments
Post a Comment