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

Export Multiple Grid into single excel

7 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nithya Rani
Top achievements
Rank 1
Nithya Rani asked on 09 Jan 2012, 01:57 PM
I have 3 radgrids. while i click the export button, All the 2 grids should be exported into the single excel file.
first grid should be sheet1, 2nd grid should be in sheet2 accordingly.
Whether this is possible. If this is possible how can we do this.
this is my grid code
<table runat="server" id="GridTable" visible="false" width="100%">
            <tr>
                <td>
                    <div class="pageheadertext">
                        On-Hand
                    </div>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <telerik:RadGrid ID="RadGrid_LotDetailsonHand" runat="server" AllowPaging="True"
                        AllowSorting="True" EnableLinqExpressions="false" Width="90%" AutoGenerateEditColumn="false"
                        AutoGenerateColumns="False" OnPageIndexChanged="RadGrid_LotDetailsonHand_PageIndexChanged"
                        Visible="false" ShowFooter="True">
                        <PagerStyle Mode="NextPrevAndNumeric" />
                        <HeaderStyle BorderStyle="Solid" Font-Bold="true" HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Left" Font-Underline="false" />
                        <AlternatingItemStyle HorizontalAlign="Left" Font-Underline="false" />
                        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                            <Excel Format="ExcelML" />
                        </ExportSettings>
                        <MasterTableView AllowPaging="true" CommandItemDisplay="Top" AllowMultiColumnSorting="false"
                            ShowGroupFooter="true">
                            <CommandItemSettings ShowExportToExcelButton="true" ShowRefreshButton="false" ShowAddNewRecordButton="false"
                                ShowExportToCsvButton="false" ShowExportToPdfButton="true" ShowExportToWordButton="true" />
                            <PagerStyle Mode="NextPrevAndNumeric" />
                            <Columns>
                                <telerik:GridBoundColumn HeaderText="Warehouse" UniqueName="Warehouse_code" DataField="WAREHOUSE_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Location" UniqueName="Locetion_code" DataField="LOCATION_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridCalculatedColumn HeaderText="Qty" UniqueName="qty" ItemStyle-HorizontalAlign="Right"
                                    DataFields="QTTY, PACKSHORT_DESC" Expression='{0}+ " " +{1}' />
                                <%--  <telerik:GridBoundColumn Aggregate="Sum" HeaderText="Qty" UniqueName="qty" ItemStyle-HorizontalAlign="Right"
                                    DataField="QTTY">
                                    
                                </telerik:GridBoundColumn>--%>
                                <telerik:GridBoundColumn HeaderText="Owner" UniqueName="Owner_Code." DataField="OWNER_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Status" UniqueName="Status" DataField="STATUS"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="pageheadertext">
                        Received
                    </div>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <telerik:RadGrid ID="RadGrid_LotDetailsOnRecev" runat="server" AllowPaging="True"
                        AllowSorting="True" EnableLinqExpressions="false" Width="90%" AutoGenerateEditColumn="false"
                        AutoGenerateColumns="False" OnPageIndexChanged="RadGrid_LotDetailsOnRecev_PageIndexChanged"
                        Visible="false">
                        <PagerStyle Mode="NextPrevAndNumeric" />
                        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                            <Excel Format="ExcelML" />
                        </ExportSettings>
                        <MasterTableView AllowPaging="true" CommandItemDisplay="Top">
                            <CommandItemSettings ShowExportToExcelButton="true" ShowRefreshButton="false" ShowAddNewRecordButton="false"
                                ShowExportToCsvButton="true" ShowExportToPdfButton="true" ShowExportToWordButton="true" />
                            <PagerStyle Mode="NextPrevAndNumeric" />
                            <Columns>
                                <telerik:GridDateTimeColumn DataType="System.DateTime" HeaderText="Date" UniqueName="Date"
                                    ItemStyle-HorizontalAlign="Left" DataField="DATETIME" DataFormatString="<%$Appsettings:dateformat%>">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Left" SortExpression="PO_ORDER_NO"
                                    HeaderText="Order" UniqueName="Order">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkOrdNum" runat="server" OnClick="lnkrefNum_Click" ForeColor="DarkBlue"
                                            CommandArgument='<%# DataBinder.Eval (Container.DataItem, "ORDER_NO2") %>' Text='<%# DataBinder.Eval (Container.DataItem, "PO_ORDER_NO") %>'
                                            ValidationGroup='<%# DataBinder.Eval (Container.DataItem, "SRORDER_ID") %>'>
                                        </asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderText="(Alt Order)" UniqueName="Alt_Order" DataField="ORDER_NO2"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridCalculatedColumn HeaderText="Qty" UniqueName="qty" ItemStyle-HorizontalAlign="Right"
                                    DataFields="QTTY, PACKSHORT_DESC" Expression='{0}+ " " +{1}' />
                                <telerik:GridBoundColumn HeaderText="Owner" UniqueName="Owner_Code." DataField="OWNER_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Status" UniqueName="Status" DataField="STATUS"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Warehouse" UniqueName="Warehouse_code" DataField="WAREHOUSE_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Source" UniqueName="source" ItemStyle-HorizontalAlign="Left"
                                    DataField="SOURCE">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="pageheadertext">
                        Shipped
                    </div>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <telerik:RadGrid ID="RadGrid_LotDetailsShipper" runat="server" AllowPaging="True"
                        AllowSorting="True" EnableLinqExpressions="false" Width="90%" AutoGenerateEditColumn="false"
                        AutoGenerateColumns="False" OnPageIndexChanged="RadGrid_LotDetailsShipper_PageIndexChanged"
                        Visible="false">
                        <PagerStyle Mode="NextPrevAndNumeric" />
                        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                            <Excel Format="ExcelML" />
                        </ExportSettings>
                        <MasterTableView AllowPaging="true" CommandItemDisplay="Top">
                            <CommandItemSettings ShowExportToExcelButton="true" ShowRefreshButton="false" ShowAddNewRecordButton="false"
                                ShowExportToCsvButton="true" ShowExportToPdfButton="true" ShowExportToWordButton="true" />
                            <PagerStyle Mode="NextPrevAndNumeric" />
                            <Columns>
                                <telerik:GridDateTimeColumn DataType="System.DateTime" HeaderText="Date" UniqueName="Date"
                                    ItemStyle-HorizontalAlign="Left" DataField="DATETIME" DataFormatString="<%$Appsettings:dateformat%>">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Left" SortExpression="CO_ORDER_NO"
                                    HeaderText="Order" UniqueName="Order">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkOrdNum" runat="server" OnClick="lnkrefNum_Click" ForeColor="DarkBlue"
                                            CommandArgument='<%# DataBinder.Eval (Container.DataItem, "ORDER_NO2") %>' Text='<%# DataBinder.Eval (Container.DataItem, "CO_ORDER_NO") %>'
                                            ValidationGroup='<%# DataBinder.Eval (Container.DataItem, "SRORDER_ID") %>'>
                                        </asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderText="(Alt Order)" UniqueName="Alt_Order" DataField="ORDER_NO2"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridCalculatedColumn HeaderText="Qty" UniqueName="qty" ItemStyle-HorizontalAlign="Right"
                                    DataFields="QTTY, PACKSHORT_DESC" Expression='{0}+ " " +{1}' />
                                <telerik:GridBoundColumn HeaderText="Owner" UniqueName="Owner_Code." DataField="OWNER_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Status" UniqueName="Status" DataField="STATUS"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Warehouse" UniqueName="Warehouse_code" DataField="WAREHOUSE_CODE"
                                    ItemStyle-HorizontalAlign="Left">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Designation" UniqueName="Designation" ItemStyle-HorizontalAlign="Left"
                                    DataField="DEST">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                </td>
            </tr>
        </table>

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 09 Jan 2012, 02:11 PM
Hello,

Take a look into the following code library.
Export multiple RadGrids in single PDF/Excel file

Thanks,
Princy.
0
Margret
Top achievements
Rank 1
answered on 11 Jul 2013, 06:57 AM
Hi,
Can we do the export multiple grid into single excel in separate sheets without having the wrapper grid concept as you told in the last example link?
0
Kostadin
Telerik team
answered on 15 Jul 2013, 02:21 PM
Hello Margret,

Please review the following example from our SDK. As you could see we are using an ExportInfrastructure and manually generated the exported excel file. This way you could export multiple RadGrids in a single or multiple spreadsheets.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Margret
Top achievements
Rank 1
answered on 30 Jul 2013, 02:05 PM

Hi,
 I have used the following namespace in my project.
using Telerik.Web.UI.GridExcelBuilder;
using xls = Telerik.Web.UI.ExportInfrastructure;
But it shows type are namespce ExportInfrastructure doesnt exist in the Telerik.Web.UI namespace.I have to add any reference in bin folder?

Regards,
Margret

0
Margret
Top achievements
Rank 1
answered on 31 Jul 2013, 05:23 AM
Hi ,
any update on this?
Regards,
Margret.
0
Maria Ilieva
Telerik team
answered on 02 Aug 2013, 10:25 AM
Hello Margret,

Note that the Telerik Export Infrastructure is released in Q2 2012 which means that in case you are using earlier version of the controls the presented behavior is expected. Upgrade your application at least to the mentioned version and verify if this helps.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Margret
Top achievements
Rank 1
answered on 05 Aug 2013, 05:25 AM
Hi,Maria.
Thanks for your clarification.I have used the earlier version telerik v2011.1.519.35.
Regards,
Margret.
Tags
Grid
Asked by
Nithya Rani
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Margret
Top achievements
Rank 1
Kostadin
Telerik team
Maria Ilieva
Telerik team
Share this question
or