1. aspx background code output content type information
Copy Code code as follows:
Response.clearcontent ();
Response.AddHeader ("Content-disposition", "attachment; Filename=myexcelfile.xls ");
Response.ContentType = "Application/excel";
Response.Write (getgridtablehtml (GRID1));
Response.End (); 2. Direct output HTML code
Response.Write (@ "
<table border= "1" >
<tr>
<td>Excel</td>
<td>by html</td>
</tr>
</table> ")
Such implementations are sufficient for simple export of data to Excel.
The usage is very simple
The introduction of the Bootstrap.js and the export-all.js in the compression package will be used
You can refer to Main.js (the following is the definition of grid when specifying a toolbar for xtype: ' Exporterbutton ')
Copy Code code as follows:
HEIGHT:350,
width:600,
Title: ' Array Grid ',
Renderto: ' Grid-example ',
Viewconfig: {
Striperows:true
},
Dockeditems: [
{
Xtype: ' Toolbar ',
Dock: ' Top ',
Items: [
{
Xtype: ' Exporterbutton ',
Store:mystore
Two configurations have been configured in Buttion.js the default path does not need to be repeatedly specified
Swfpath: './downloadify.swf ',
Downloadimage: './download.png ',
Here you can export the file name according to the form
Downloadname: ' Exported Excel name '
}
]
}
]