public void ExportToExcel(string GridModel)
{
ExcelExport exp = new ExcelExport();
ExcelEngine excel = new ExcelEngine();
IApplication application = excel.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
var DataSource = new NorthwindDataContext().OrdersViews.Take(100).ToList();
GridProperties obj = ConvertGridObject(GridModel);
workbook.Worksheets[0].ImportData(DataSource, 1, 1, true);
workbook.SaveAs("Exported.xls", HttpContext.ApplicationInstance.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel2010);
//exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
} |
|
public void ExportToExcel(string GridModel)
{
ExcelExport exp = new ExcelExport();
var DataSource = new NorthwindDataContext().OrdersViews.Take(100).ToList();
GridProperties obj = ConvertGridObject(GridModel);
obj.Columns[3].Visible = false; // define visible property as false while exporting based on column index.
exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
} |
|
|