| private void tonnageByArrivalExportButton_Click(object sender, RoutedEventArgs e) |
| { |
| string extension = "xls"; |
| SaveFileDialog dialog = new SaveFileDialog() |
| { |
| DefaultExt = extension, |
| Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"), |
| FilterIndex = 1 |
| }; |
| if (dialog.ShowDialog() == true) |
| { |
| try |
| { |
| using (Stream stream = dialog.OpenFile()) |
| { |
| GridViewExportOptions exportOptions = new GridViewExportOptions(); |
| exportOptions.Format = ExportFormat.Html; |
| exportOptions.ShowColumnHeaders = true; |
| exportOptions.ShowColumnFooters = true; |
| exportOptions.ShowGroupFooters = false; |
| tonnageByArrivalTable.Export(stream, exportOptions); |
| } |
| } |
| catch (IOException) |
| { |
| // File in use |
| } |
| catch |
| { |
| // Another exception type |
| } |
| } |
| } |
10 Answers, 1 is accepted
Do you have our latest service pack (Q1 2010 SP2)?
Sincerely yours,Vlad
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.
It has been fixed in our internal builds since before our SP2 release. You can install our SP2 release alongside the SP1 release. Different RadControls versions can live side by side. The binaries are stored in separate folders in your Telerik RadControls installation folder (C:\Program Files\Telerik), so there's no danger to your current project.
I can recommend installing our SP2 release and testing the functionality in a separate test project referencing the SP2 controls.
Yavor Georgiev
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.
| <telerikGridView:RadGridView Name="tonnageByPlantTable" |
| Exporting="tonnageByPlantTable_Exporting" |
| AutoExpandGroups="True" |
| IsFilteringAllowed="False" |
| ShowGroupFooters="True" ShowColumnHeaders="True" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" |
| AutoGenerateColumns="False" |
| EnableRowVirtualization="True" |
| Grid.Row="2"> |
| <telerikGridView:RadGridView.GroupDescriptors> |
| <telerikData:GroupDescriptor Member="Group" > |
| </telerikData:GroupDescriptor> |
| </telerikGridView:RadGridView.GroupDescriptors> |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn Header="Ship To" HeaderTextAlignment="Center" UniqueName="ShipTo" TextAlignment="Left" IsReadOnly="True" MinWidth="50" > |
| </telerikGridView:GridViewDataColumn> |
| <telerikGridView:GridViewDataColumn Header="Packing Slip Count" HeaderTextAlignment="Center" UniqueName="PackingSlipCount" TextAlignment="Left" IsReadOnly="True" MinWidth="50" > |
| <telerikGridView:GridViewColumn.AggregateFunctions> |
| <telerikData:SumFunction Caption="# Packing Slips: " /> |
| </telerikGridView:GridViewColumn.AggregateFunctions> |
| </telerikGridView:GridViewDataColumn> |
| <telerikGridView:GridViewDataColumn Header="Total Weight" HeaderTextAlignment="Center" UniqueName="CalcGrossWeight" TextAlignment="Center" IsReadOnly="True" MinWidth="50" DataFormatString="{}{0:F} lbs"> |
| <telerikGridView:GridViewColumn.AggregateFunctions> |
| <telerikData:SumFunction Caption="Total Weight: "/> |
| </telerikGridView:GridViewColumn.AggregateFunctions> |
| </telerikGridView:GridViewDataColumn> |
| <telerikGridView:GridViewDataColumn Header="Group" HeaderTextAlignment="Center" UniqueName="Group" TextAlignment="Center" IsReadOnly="True" MinWidth="50" > |
| </telerikGridView:GridViewDataColumn> |
| </telerikGridView:RadGridView.Columns> |
| </telerikGridView:RadGridView> |
This is a known issue and has been recently fixed. The fix will be available in our imminent Q2 Beta release, and also the weekly internal build published each Friday, which you can download from your account. The fix will be in tomorrow's internal build.
Kind regards,Yavor Georgiev
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.
This is the kind of data I'm getting in every cell in excel:
"[QCVG: Key=item 0; ItemCount=1; HasSubgroups=False; ParentGroup=[QCVG: Key=Root; ItemCount=10; HasSubgroups=True; "
What could be the problem?
Thx
Group footers will not be exported by default - you need to catch ElementExporting event and provide value similar to this demo.
Greetings,Vlad
the Telerik team
I am having an issue where if I set ShowGroupFooters = true on the GridViewExportOptions the Group Header information is no longer generated. If I set it to false, then I get the GroupHeaderRow and GroupHeaderCells generated in the ElementExporting event. I want both the Headers and the Footers so this is quite frustrating. I am using identical export code as in your demo, but can see that the demo generates both the Group Headers and Footers when exporting so not sure where I am going wrong.
Any ideas?
[Edit]
Sorry I should amend this; the issue is not to do with whether ShowGroupFooters is true or false, I have instead discovered that the Group Headers are only exported if the ExportFormat is Html.
Is there any reason for this?
Indeed currently this is implemented only for HTML export. We will do our best to provide this for ExcelML as soon as possible.
Best wishes,Vlad
the Telerik team
