Embed Excel sheet in web page
-
Hi all, how can i embed excel sheet with everything it holds (pivot table, charts ...) in an aspx page. any ideas, thanks
You can just create a web page (e.g. WebForm1.aspx) in asp.net and put the following code in Page_Load event in code behind page
Response.ContentType = "application/vnd.ms-excel";
string sFile = Server.MapPath("MyExcel.xls");
FileStream fs = new FileStream(sFile, FileMode.Open, FileAccess.Read);
byte[] b = new byte[(int)fs.Length];
fs.Read(b, 0, (int)fs.Length);
fs.Close();
Response.Clear();
Response.BinaryWrite(b);
Response.End();
Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
You can just create a web page (e.g. WebForm1.aspx) in asp.net and put the following code in Page_Load event in code behind page
Response.ContentType = "application/vnd.ms-excel";
string sFile = Server.MapPath("MyExcel.xls");
FileStream fs = new FileStream(sFile, FileMode.Open, FileAccess.Read);
byte[] b = new byte[(int)fs.Length];
fs.Read(b, 0, (int)fs.Length);
fs.Close();
Response.Clear();
Response.BinaryWrite(b);
Response.End();
Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
This will create a new excel sheet. But samerh want the excel inside the aspx page like the images and gif files.
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
Hi all, how can i embed excel sheet with everything it holds (pivot table, charts ...) in an aspx page. any ideas, thanks
Check it out http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e475fa75-03e5-4cbf-8d0b-f44acaaa97dc[^]
Regards Aman Bhullar www.arlivesupport.com[^]