I Use to Net version.(grid_excel_net)
How to Excel Conversion in Grid?
Not used PHP version.
Hi,
you should add references to dlls from /lib folder of grid_excel_net package,
after it, you’ll need to create generic handler(ashx file) which will pass serialized grid data to ExcelWriter object(ExcelWriter is defined in DHTMLX.Export.Excel namespace)
using DHTMLX.Export.Excel;
namespace Generator
{
public class Generator : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var writer = new ExcelWriter();
var xml = context.Request.Form["grid_xml"];
xml = context.Server.UrlDecode(xml);
writer.Generate(xml, context.Response);
}
public bool IsReusable{get{return false;}}
}
}
- instead of creating new one, you can use Generate.ashx/Generate.ashx.cs from the grid_excel_net package
then add link to dhtmlxgrid_export.js to the page, the file can be found in codebase/ext folder of dhtmlxGrid package.
after it you can use mygrid.toExcel(path) to export grid data to excel
e.g.
mygrid.toExcel("Generate.ashx")
hello!
I followed what you say,but I can ont use mygrid.toExcel(),My steps is followed:
1.I add references these dlls to my codebase.
2.I copy the three ashx files which in the pagkage to my codebase.
3.I add link dhtmlxgrid_export.js to my pag.
4.Calling the mygrid.toExcel() method.
when I call this method,there is nothing happen,and I use the last grid-excel-net version
Please help me check the mistake.
I have solved this problem, I alter my webconfig’s encoding,when I use other encoding(gb2312) ,the mygrid.toExcel does not work.