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

Export From RadGrid to ExcelML is missing group data

5 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 19 Apr 2012, 10:05 PM
I am using grouping on my grid for a single column.  When I export using ExcelML, all of the data comes over except for the actual group data.  I even see the row where I would expect the group information to be.

Is there a setting I am missing?
<telerik:RadGrid ID="rgWeightBreaks" runat="server">
    <MasterTableView AutoGenerateColumns="false" GroupsDefaultExpanded="false" GroupLoadMode="Client"
        DataKeyNames="OriginAirport, DestinationAirport, TariffNumber" ClientDataKeyNames="OriginAirport, DestinationAirport, TariffNumber"
        CommandItemDisplay="Top">
        <Columns>
            <telerik:GridBoundColumn HeaderText="Origin City" DataField="OrigAirportCity" HeaderStyle-Width="200px" ItemStyle-Width="200px" Display="false" UniqueName="OriginCity"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Destination City" DataField="DestAirportCity" HeaderStyle-Width="200px" ItemStyle-Width="200px"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Airport" DataField="DestinationAirport" HeaderStyle-Width="50px" ItemStyle-Width="50px"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Transit Days" DataField="TransitDays" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Minimum Charge" DataField="MinimumCharge" HeaderStyle-Width="100px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right" DataFormatString="${0}"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="500" DataField="BreakOne" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="75px" ItemStyle-HorizontalAlign="Right" DataFormatString="${0}"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="1000" DataField="BreakTwo" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="75px" ItemStyle-HorizontalAlign="Right" DataFormatString="${0}"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="2000" DataField="BreakThree" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="75px" ItemStyle-HorizontalAlign="Right" DataFormatString="${0}"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="5000" DataField="BreakFour" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="75px" ItemStyle-HorizontalAlign="Right" DataFormatString="${0}"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="7500" DataField="BreakFive" HeaderStyle-Width="75px" HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="75px" ItemStyle-HorizontalAlign="Right" DataFormatString="${0}"></telerik:GridBoundColumn>
        </Columns>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="OrgAirportCity" FieldAlias="Gateway" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="OrgAirportCity" FieldAlias="Gateway" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <CommandItemSettings ShowExportToExcelButton="true" />
    </MasterTableView>
    <ClientSettings AllowExpandCollapse="true" EnableRowHoverStyle="true">
        <Selecting AllowRowSelect="true" />
        <Scrolling UseStaticHeaders="true" />
    </ClientSettings>
    <ExportSettings OpenInNewWindow="true" ExportOnlyData="true">
        <Excel Format="ExcelML" />
    </ExportSettings>
</telerik:RadGrid>

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Apr 2012, 09:42 AM
Hi Seth,

Try setting the UseAllDataFields property to true (ot MasterTableView).

Regards,
Daniel
the Telerik team
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 their blog feed now.
0
Seth
Top achievements
Rank 1
answered on 07 May 2012, 09:58 PM
Hi Daniel,

No luck.  Here is some more information.  I have the one column grouped by default when the page loads.  When I do that, the group text does not show when exported.  If I do not have the column grouped by default and I group it client side afterwards, the group text is shown.

Seth
0
Daniel
Telerik team
answered on 11 May 2012, 09:07 AM
Hi Seth,

I'm afraid I can't reproduce this problem. Attached to this post are two exported files. The first one was generated when manually  The latter one was generated with predefined group.
Here is my markup (no code-behind):
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDS1" ShowGroupPanel="true">
    <ClientSettings AllowDragToGroup="true" />
    <MasterTableView CommandItemDisplay="Top">
        <CommandItemSettings ShowExportToExcelButton="true" />
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="CategoryName" />
                </GroupByFields>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="CategoryName" />
                </SelectFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
    </MasterTableView>
    <ExportSettings Excel-Format="ExcelML" ExportOnlyData="true" />
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDS1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]">
</asp:SqlDataSource>

Regards,
Daniel
the Telerik team
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 their blog feed now.
0
Jeremy
Top achievements
Rank 1
answered on 05 Aug 2014, 10:20 PM
I ran into this exact same issue today. I'm using version 2013.3.1114.40. After reviewing the code example from Daniel, I noticed that my markup included FieldAlias as shown below. If I remove the FieldAlias property, the Group exports correctly. If I include FieldAlias like below, it will not show up in the exported excel spreadsheet. If I remove the Group from the Group Panel, and then add it back by dragging the column to the Group Panel, it will show up on the exported excel sheet. I have the same problem if I add it programmatically in the Radgrd1_PreRender event.

Jeremy

<telerik:GridGroupByExpression>
    <SelectFields>
        <telerik:GridGroupByField FieldAlias="Year" FieldName="FiscalYear"></telerik:GridGroupByField>
    </SelectFields>
    <GroupByFields>
        <telerik:GridGroupByField FieldName="FiscalYear"></telerik:GridGroupByField>
    </GroupByFields>
</telerik:GridGroupByExpression>

0
Daniel
Telerik team
answered on 08 Aug 2014, 03:55 PM
Hello Jeremy,

HTML export would be a better option for cases like this. ExcelML has its own limitations when it comes to grouping, hierarchy, and non-data fields because of the fact that it builds its structure directly from the datasource.

Regards,
Daniel
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.

 
Tags
Grid
Asked by
Seth
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Seth
Top achievements
Rank 1
Jeremy
Top achievements
Rank 1
Share this question
or