Hi,
I’m trying to add an image to a spreadsheet, I can see that there’s a new picture in the Selection pane in the spreadsheet but it’s not displayed.
My reading suggests it’s likely to be my handling of the MemoryStream
but I’m not sure where I’m going wrong.
string docId = paramIn["cmapscLogo30"].ToString();
var cd = new System.Net.Mime.ContentDisposition();
string messageDetails = "";
string docContentType = "";
string fileName = "";
byte[] imageBytes = doc.pullDocument( docId, ref cd, ref docContentType, ref fileName, ref messageDetails, tenant );
MemoryStream ms = new MemoryStream(imageBytes);
System.Drawing.Image image;
image = System.Drawing.Image.FromStream(ms);
dataWorksheet.Pictures.Add(ms, ExcelPictureFormat.Png, 200,200, image.Width, image.Height, LengthUnit.Pixel);
configurationWorksheet.Cells[13, 0].Value = image.Width;
configurationWorksheet.Cells[14, 0].Value = image.Height;
I’ve written out the width and height of the image so I know the image has been retrieved successfully.
Thanks in advance.