briefly introduces a method that can use simple JS to export the information in the Web page to Excel and print, and you need a friend to refer to the following
In small projects that are not very high in requirements, you can implement these features with technologies that are not generic and are not new but can actually implement functionality well. This system is not shown to be complex and can be easily maintained. Create a new exportprint.html page with the code shown below to enable you to export to Excel and print your Web pages. Code as follows: <html> <head> <title>ie Browser use JS technology to export to Excel and print </title> <style> .table_stat { border-right:0px; border-bottom:0px; Bo rder-left:1px solid #819BD8; BORDER-TOP:1PX solid #819BD8;   .td_stat { border-right:1px solid #819BD8; BORDER-BOTTOM:1PX Solid #819BD8; &NBSP} </style> </head> <body> <object classid= "CLSID : 8856f961-340a-11do-a96b-00c04fd705a2 "height=" 0 "id=" WebBrowser "width=" 0 "></object> <table Width= "100%" align= "center" border= "0" cellpadding= "0" cellspacing= "0" style= "text-align:center;" class= "Table_stat" > <tr> <TD id= "title" align= "Center" nowrap= "NoWrap "class=" Td_stat "colspan=" 2 "> user information </td> </tr>   ; <tr> <TD id= "title" align= "Center" nowrap= "nowrap" class= "Td_stat" colspan= "1" > & nbsp name </td> <TD id= "title" align= "Center" nowrap= "nowrap" class= "Td_stat" colspan = "1" > John </td> </tr> <tr> & nbsp <TD id= "title" align= "Center" nowrap= "nowrap" class= "Td_stat" colspan= "2" > <input type= " Button "id=" Export "value=" exports "onclick=" javascript:exporttoexcel (); "> <input type=" button " id= "Print" value= "onclick=" Javascript:print (); "> </td> </tr> </ table> </body> </html> <script type= "Text/javascript" > //Export to Excel function exportToExcel () { IF (document.getElementById ("title")) { try { var orangeref = Document.body.createTextRange (); nbsp Orangeref.execcommand ("Copy"); var appexcel = new ActiveXObject ("Excel.Application"); appexcel.visible = true; APPEXCEL.WORKBOOKS.ADD (). Worksheets.item (1). Paste (); &NBSP} catch (e) { alert ("Error!") Maybe the browser or the amount of data is too big! "); return; &NBSP} appexcel = null; &NBSP;ORANGEREF = null; }   //printing function print () { if (document.getElementById ("title")) { var Export = document.getElementById ("Export"); var print = document.getElementById ("print"); try { Export.style.display = "none"; Print.style.display = "none"; Document.all.WebBrowser.ExecWB (6,1); &NBSP} catch (e) { alert ("Error!") Maybe the browser or the amount of data is too big! "); return; &NBSP;} export.style.display = ""; print.style.display = ""; } } </script>