Skip to content

Replies

0
Francesco
Francesco answered on May 26, 2010 9:33 AM

Hi Lyuba,
your suggestion work fine for me.

Thanks for help.
Francesco

0
Francesco
Francesco answered on May 25, 2010 4:53 PM

Hi Dimi,
have you a good news for my problem?

My customer press me for a solution.

Thank you, best regards,
Francesco

0
Francesco
Francesco answered on May 19, 2010 10:22 AM

Hi,

sorry for my late.

I tried the solution supplied, but I give an error with the snippet. My imgUrl member is a string like http://www.mysite.com/mypics.jpg.

System.Drawing.Image image = Bitmap.FromFile(imgUrl); throw the System.ArgumentException with description: URI formats not supported.
in System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
in System.IO.Path.NormalizePath(String path, Boolean fullCheck)
in System.IO.Path.GetFullPathInternal(String path)
in System.IO.Path.GetFullPath(String path)
in System.Drawing.IntSecurity.UnsafeGetFullPath(String fileName)
in System.Drawing.IntSecurity.DemandReadFileIO(String fileName)
in System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
in System.Drawing.Image.FromFile(String filename)

Can you give me support?

In FromStream method my memorystream will remain open until the shape method:

 

 

 

byte[] imageData = wc.DownloadData(imgUrl);

 

 

using (MemoryStream ms = new MemoryStream(imageData))

{

System.Drawing.

 

Image image = System.Drawing.Image.FromStream(ms);

 

 

//System.Drawing.Image image = Bitmap.FromFile(imgUrl);

 

 

 

WorksheetImage imageShape = new WorksheetImage(image);

 

 

WorksheetCell cellA1 = worksheet.Rows[rowIndex].Cells[0];

imageShape.TopLeftCornerCell = cellA1;

 

imageShape.TopLeftCornerPosition =

 

new PointF(0.0F, 0.0F);

imageShape.BottomRightCornerCell = cellA1;

 

imageShape.BottomRightCornerPosition =

 

new PointF(100.0F, 100.0F);

worksheet.Shapes.Add(imageShape);

}

Thanks