![]() |
Web Development »
ASP.NET »
Howto
Intermediate
Link ASP.NET Data Grid to Microsoft Excel in the client sideBy mohammed barqawiHow to use JavaScript to export HTML table into Excel work sheet? |
C#, Javascript.NET 1.1, WinXP, ASP.NET, VS.NET2003, IE 6.0, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

I was playing with internet explorer context menu, suddenly I noted that I have menu item called "export to Microsoft Excel".

When I clicked on this command it is transferred the contents of the selected table to Microsoft excel.
To guess what was happing on when I clicked on the context menu item, I used the IE feature, break at next statement (from menu item choose View-> Script Debugger->Break at Next Statement ), and made a small table and as I clicked on the menu and I got the VBScript file in Visual Studio .NET.
I have used something called HTC "HTML Components" which is a good thing to learn if you are developing an ASP.NET Server Control. My HTC script is divided in to two parts :
datagrid, and that was by
ImgaElement=this.document.createElement("img")
datagrid table. ImgaElement.style.top=this.element.offsetTop-3
ImgaElement.style.left=this.element.offsetLeft+offsetWidth-3try
{
xlApp= new ActiveXObject("Excel.Application");
}
catch(e)
{
alert("Please check the Internet security setting");
return -1;
}
in the security tab in the internet security settings.
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 12 Dec 2004 Editor: Sumalatha K.R. |
Copyright 2004 by mohammed barqawi Everything else Copyright © CodeProject, 1999-2009 Web21 | Advertise on the Code Project |