我已经看到导出到syncfusion网格的excel功能 http://www.syncfusion.com/kb/5040/how-to-export-the-grid-in-angularjs
我必须为syncfusion网格做导出功能。那么可以给出那个
的示例代码 <div id="Grid" ej-grid e-columns="columns" e-datasource="data" e-toolbarsettings='tools' e-toolbarclick="toolbarHandler" e-allowpaging="true"></div>
答案 0 :(得分:0)
Syncfusion.EJ
和Syncfusion.EJ.Export
,您可以从该位置找到它们
C:\Program Files (x86)\Syncfusion\Essential Studio\xx.x.x.xx\Assemblies
其中xx.x.xx.xx
是必备工作室的版本。
http://help.syncfusion.com/ug/js/index.html#!Documents/exporting3.htm
答案 1 :(得分:0)
导出书面代码::
[System.Web.Http.ActionName("ExcelExport")]
[AcceptVerbs("POST")]
public void ExcelExport()
{
string gridModel = HttpContext.Current.Request.Params["GridModel"];
GridProperties gridProperty = ConvertGridObject(gridModel);
ExcelExport exp = new ExcelExport();
IEnumerable<ProgramFull> result = ProgramService.GetFullList();
exp.Export(gridProperty, result, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
}
但在行
GridProperties gridProperty = ConvertGridObject(gridModel);
给出“ConvertGridObject”的错误在当前上下文中不存在
即使我添加了dll,也会找不到找不到syncfusion命名空间的错误 在参考文献中
答案 2 :(得分:0)
你在这里:
public GridProperties ConvertGridObject(string gridProperty)
{
var serializer = new JavaScriptSerializer();
var div = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
var gridProp = new GridProperties();
foreach (KeyValuePair<string, object> ds in div)
{
var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
if (property != null)
{
var type = property.PropertyType;
var serialize = serializer.Serialize(ds.Value);
var value = serializer.Deserialize(serialize, type);
property.SetValue(gridProp, value, null);
}
}
return gridProp;
}