Problem with export of column's footer

7 posts, 0 answers
  1. Viki
    Viki avatar
    20 posts
    Member since:
    Dec 2010

    Posted 15 May 2011 Link to this post

    Hi,
    I have a following footer:
    in XAML:
      
    <telerik:GridViewColumn.FooterCellStyle>
                            <Style TargetType="telerik:GridViewFooterCell">
                                <Setter Property="ContentTemplate">
                                    <Setter.Value>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Text, ElementName=txtTest}"/>
                                        </DataTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </telerik:GridViewColumn.FooterCellStyle>
      
      
    <TextBlock Grid.Row="3" Grid.Column="1" x:Name="txtTest" Text="Employee name: "/>
      
    ============================================================
    in C#:
      
    txtTest.Text += m_EmployeeReport.EmployeeName;

    that works fine, but when I try to export it to Excel, I don't get it, my export options as follows:
    if (dialog.ShowDialog() == true) 
                    
                        using (Stream stream = dialog.OpenFile()) 
                        
                            GridViewExportOptions exportOptions = new GridViewExportOptions(); 
                            exportOptions.Format = ExportFormat.ExcelML; 
                            exportOptions.ShowColumnFooters = true; 
                            exportOptions.ShowColumnHeaders = true; 
                            exportOptions.ShowGroupFooters = false; 
        
                            gridEmployeeResult.Export(stream, exportOptions); 
                        }

    I tried the simple footer, without binding, as follows:
    <telerik:GridViewDataColumn.Footer>
               <TextBlock Text="HELLO"/>
    </telerik:GridViewDataColumn.Footer>

    I see it on the grid, but I don't get it on export to Excel

    What I'm doing wrong?

    Thanks,
    Viki
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 16 May 2011 Link to this post

    Hi Viki,

    Please take a look at this demo for a reference.
     

    Kind regards,
    Maya
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Ryan
    Ryan avatar
    11 posts
    Member since:
    Aug 2008

    Posted 04 Nov 2011 Link to this post

    Maya,

    I can't get the footer to export to Excel either. I'm actually using the code form the demo you pointed to in your link. The Footer export fine when I use AggregateFunctions. They however do not export when I do either of the following.

    1.
    <telerik:GridViewDataColumn
         CellStyle="{StaticResource RadGridViewCellStyle}"
         DataMemberBinding="{Binding Tank.Name}"
         Header="Tank"
         IsReadOnly="True"
         Footer="Totals:"
    />
    2.
    <telerik:GridViewDataColumn CellStyle="{StaticResource RadGridViewCellStyle}" DataMemberBinding="{Binding Tank.Name}" Header="Tank" IsReadOnly="True">
        <telerik:GridViewDataColumn.Footer>
            <TextBlock Text="Totals:" />
        </telerik:GridViewDataColumn.Footer>
    </telerik:GridViewDataColumn>

  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Nov 2011 Link to this post

    Hello,

     Have you tried to assign e.Value according to your custom footer in ElementExporting event?

    All the best,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Ryan
    Ryan avatar
    11 posts
    Member since:
    Aug 2008

    Posted 04 Nov 2011 Link to this post

    Vlad,

    Yes, I have tried to assign it there. When I was looking through e.Context to find the value I wanted to use I didn't see it in context.

    Thank you,
    Ryan Duclos
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Nov 2011 Link to this post

    Hi,

    You can find an example project attached. 

    Regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Ryan
    Ryan avatar
    11 posts
    Member since:
    Aug 2008

    Posted 08 Nov 2011 Link to this post

    Vlad,

    Thanks, the demo application works perfectly. I think I may have been looking at the wrong ExportElement when parsing through e.Context. Either way I have it working now. Thanks, again.
Back to Top
DevCraft banner