Jun 16, 2012 at 8:21 PM
Edited Jun 16, 2012 at 8:22 PM
|
Hello,
Really enjoying the EPPlus library, but I'm having an issue inserting an image into each row of an Excel file. I tried to mimic the calls in a previous discussion thread (http://epplus.codeplex.com/discussions/229134),
but all the images except the image in the final row seem to be sized incorrectly. In fact, when I tried adjusting the sizes of the images by setting the height to half of the actual image height (just to see what would happen), only the final row was affected;
the rest were the same (incorrect) size they had been before. Not sure what I'm doing wrong, but here's my approach:
var image = Image.FromStream(s);
row.Height = ConvertPixelsToRowHeight(image.Height);
sheet.Column(columnNumber).Width = ConvertPixelsToColumnWidth(sheet, image.Width + 1);
ExcelPicture picture = sheet.Drawings.AddPicture("Row-" + rowNumber.ToString() + "-Col-" + columnNumber.ToString(), image);
picture.SetPosition(rowNumber - 1, 2, columnNumber - 1, 2);
picture.SetSize(image.Width, image.Height);
Any assistance is greatly appreciated. Thanks very much,
- Daniel
|
|
|
|
I'm having the same problem as Daniel.
Has there been a solution?
Thanks
Frédéric
|
|
|
|
You have to set all the row heights first, before you embed a single image. The minute you touch a row height it distorts all the images again.
|
|