This is a migrated thread and some comments may be shown as answers.

Exporting nested radgrid to multiple worksheet in excel

2 Answers 372 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ank
Top achievements
Rank 1
Ank asked on 03 Oct 2014, 07:14 PM
Hi,

I am using 2 level telerik radgrid to display information for purchase order(PO) and purchase order(PO) line items. I already have export to excel which exports the data into an excel sheet including the filters applied on the grid. i.e when we apply a filter on grid and click on export it only exports the data present in the filtered grid.

I have a new requirement to export the grid data into multiple worksheet in the single excel file. i.e. PO information should be exported to 1st worksheet in the excel file and PO line items information should be exported to 2nd worksheet in the same excel file. I also need to change the header information in the export. e.g. PurchaseOrderId will be renamed to PoId and so on. When a filter is applied it should only export the filtered information.
Please let me know if this is feasible. If yes, it would be great if sample code can be included. Any help would be appreciated. Thanks in advance. 

Please find some more details for current implementation. 
<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="True" AllowFilteringByColumn="true"
        runat="server" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource" GroupingSettings-CaseSensitive="false"
        GridLines="None" EnableLinqExpressions="false" ExportSettings-IgnorePaging="True" ExportSettings-Excel-Format="Html"
        MasterTableView-CommandItemDisplay="Top" ExportSettings-ExportOnlyData="true" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
        OnItemCommand="RadGrid1_OnItemCommand"> 
          <MasterTableView  DataKeyNames="PurchaseOrderId">
             <DetailTables>
                 <telerik:GridTableView runat="server" DataKeyNames="PurchaseOrderItemId" Name="1" Width="100%" HierarchyLoadMode="Client" AllowSorting="False" AllowFilteringByColumn="False">
                   <Columns>
                         <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
                   </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                    <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ...... ></telerik:GridBoundColumn>
          </Columns>
            <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
                ShowRefreshButton="false" />
        </MasterTableView>
        <GroupingSettings CaseSensitive="false" />
    </telerik:RadGrid>

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Kostadin
Telerik team
answered on 08 Oct 2014, 01:23 PM
Hi Ank,

I am afraid there isn't a built-in feature which allows you to export the detail tables in a different spreadsheet. Nevertheless you could use the ExportInfarstructure to achieve your requirement manually. I would recommend you to check out the following example which demonstrates how to export multiple grids in a single Excel file, but you could modified it to export the detail tables separately.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ank
Top achievements
Rank 1
answered on 10 Oct 2014, 10:03 AM
Hi Kostadin,

Thank you replying on the query. ExportInfarstructure did helped to meet the requirement manually.

Thanks.
Tags
Grid
Asked by
Ank
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Ank
Top achievements
Rank 1
Share this question
or