How set the ExportOption for visible into grid?

Hi Want excel export but only visible columns. So How to set ExportOption in grid?

Thanks
Jawed



2 Replies

HW he wei July 7, 2012 08:01 PM UTC

I got the similar problem, how to format export data (let's say Excel export)?

thanks,
WH


RD Rakesh D Syncfusion Team August 24, 2012 04:02 AM UTC

Hi  Jawed, he wei;

 

Thank you for your interest in Syncfusion products.

 

To achieve excel export for only visible columns, configure the grid toolbar to enable exporting grid records and Specify the file name, Excel version,ConverterOptionsExt details in the ExportToExcel() method. Please refer to the following code snippet for details.

 

View[cshtml] 

@{ Html.Syncfusion().Grid<Order>("OrdersGrid")

        .ToolBar(tools => tools.Export(GridToolBarItems.ExcelExport, "Export",           "ExportToExcel"))

.Render();

        

Controller

public ActionResult ExportToExcel()

        {

            var data = new NorthwindDataContext().Orders.Take(200).ToList();

            return data.GridExportToExcel<Order>("GridExcel.xlsx", ExcelVersion.Excel2007, ConverterOptionsExt.Visible);  //ConverterOptionExt.Visible exports only visible rows

      }

 

Please let us know if you need further assistance.


Regards,
Rakesh D



Loader.
Up arrow icon