@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.ExcelExport);
items.AddTool(ToolBarItems.WordExport);
items.AddTool(ToolBarItems.PdfExport);
}))
.AllowPaging()
.AllowFiltering()
.Columns(col =>
{
-------
})
)
-------------------------------------
public void ExportToExcel(string GridModel)
{
ExcelExport exp = new ExcelExport();
var DataSource = new NorthwindDataContext().OrdersViews.ToList();
GridProperties obj = ConvertGridObject(GridModel);
exp.Export(obj, data, "Export.xlsx", ExcelVersion.Excel2013, false, false, "flat-saffron");
}
|