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

Problem with export of column's footer

6 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Viki
Top achievements
Rank 1
Viki asked on 15 May 2011, 10:17 AM
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

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 May 2011, 07:56 AM
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
0
Ryan
Top achievements
Rank 2
answered on 04 Nov 2011, 05:19 AM
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>

0
Vlad
Telerik team
answered on 04 Nov 2011, 02:35 PM
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 >>

0
Ryan
Top achievements
Rank 2
answered on 04 Nov 2011, 02:39 PM
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
0
Vlad
Telerik team
answered on 08 Nov 2011, 03:39 PM
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 >>

0
Ryan
Top achievements
Rank 2
answered on 09 Nov 2011, 04:57 AM
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.
Tags
GridView
Asked by
Viki
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ryan
Top achievements
Rank 2
Vlad
Telerik team
Share this question
or