We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SetHeaderPicture crashed

I have used the sample C# code and Aspose.Cells version to set up header from

It crashed at pageSetup.SetHeaderPicture(1, binaryData);

Do you have updates for this sample?




Well, the code is fine and it works perfect. Since you are using some older version of Aspose.Cells, Please try the code with latest 4.4. version or attached version (

If you still find the problem, please post your image file with sample code here.

Thank you.

It works for the new dll.

I have another question. Can we specify the relative path for image file? It seems to me that it looks for c:\windows….

We have the web application and we can install the image on web server.

//Creating a string variable to store the url of the logo/picture
string logo_url = "c:\\dog.jpg"; // absolute path

//Declaring a FileStream object
FileStream inFile;

//Declaring a byte array
byte[] binaryData;
//Creating the instance of the FileStream object to open the //logo/picture in the stream
inFile = new System.IO.FileStream(logo_url, System.IO.FileMode.Open, System.IO.FileAccess.Read);


Hi Charlie,

Please refer to the following code for your need:

string path = MapPath("~");
string logo_url = path + @"\images\dog.jpg";



Thank you.

Thanks Amjad!

It works. I modified workbook.Save to

workbook.Save(strExcelFileName, FileFormatType.Default, SaveType.OpenInBrowser, this.Response);

It can be used for ASP.net.