i am getting above exception for line of code below:
System.Net.WebClient wc = new System.Net.WebClient();
byte[] data = wc.DownloadData(xmlTempNode.Attributes["imageurl"].Value.ToString());
MemoryStream ms = new MemoryStream(data);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
string strImagePath = pptdirectoryPath + "\\" + currentSlide + "_" + shape.Id + ".png";
img.Save(strImagePath);
Microsoft.Office.Interop.PowerPoint.Shape sp = shape;
xmlTempNode.Attributes["imgwidth"].Value = xmlTempNode.Attributes["imgwidth"].Value.Replace("px", "");
xmlTempNode.Attributes["imgheight"].Value = xmlTempNode.Attributes["imgheight"].Value.Replace("px", "");
//Getting exception on below line
shape.Fill.UserPicture(strImagePath);
and strImagePath
is D:\projects\MAMMP\trunk\Applications\Applications.Web\\cache\ppt\60ba9d41-00e0-44fd-9c2c-7591c881a1a0\\6_1026.png
any help guys.
Don't mix
\\
and
\
in the String Path.
Maybe it should look like:
string strImagePath = pptdirectoryPath + currentSlide + "_" + shape.Id + ".png";
The pptdirectoryPath string has also a backslash to much.
A single backslash is a so-called 'escape' character. This is used to include special characters like tab (\t) or a new line (\n). In order to specify a backslash in the case of a path you will have to 'espace' the single slash using the escape character, which means that you will have to write a double backslash.