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

Putting title header to exported radgridview

2 Answers 39 Views
GridView
This is a migrated thread and some comments may be shown as answers.
aubrey
Top achievements
Rank 1
aubrey asked on 02 May 2011, 02:53 AM
Good day telerik team, 
i would like to ask if there is a possibility that i can put title above my exported gridview.

heres my code:
  private void Export_Doc(object sender, System.Windows.RoutedEventArgs e)
       {
           ExportDialog("doc", "Word", ExportFormat.Html);
       }
    
       private void Export_excel(object sender, System.Windows.RoutedEventArgs e)
       {
           ExportDialog("xls", "Excel", ExportFormat.Html);
            
       }
 
       private void Export_csv(object sender, System.Windows.RoutedEventArgs e)
       {
           ExportDialog("csv", "CSV", ExportFormat.Csv);
       }
    
 
    private void ExportDialog(string extension, string selectedItem, ExportFormat format)
    {
           SaveFileDialog dialog = new SaveFileDialog();
           dialog.DefaultExt = extension;
           dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, selectedItem);
           dialog.FilterIndex = 1;
            
           if (dialog.ShowDialog() == true)
           {
               using (Stream stream = dialog.OpenFile())
               {                  
                   GridViewExportOptions exportOptions = new GridViewExportOptions();
                   exportOptions.Format = format;
                   exportOptions.ShowColumnFooters = true;
                   exportOptions.ShowColumnHeaders = true;
                   exportOptions.ShowGroupFooters = true;
                   RadGridView1.Export(stream, exportOptions);
               }
           
       }
  
I attached an image of what it would likely look.. ~_~
       
It would be a big help to my project thanks. 

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 02 May 2011, 06:35 AM
Hello,

 You can write directly in your stream just before exporting the grid. 

Kind regards,
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
0
aubrey
Top achievements
Rank 1
answered on 02 May 2011, 07:19 AM
Hi Vlad, 

can you kindly give me your code in writing the title directly to the Stream. based it on my code. 

hope you reply. Y_Y
Tags
GridView
Asked by
aubrey
Top achievements
Rank 1
Answers by
Vlad
Telerik team
aubrey
Top achievements
Rank 1
Share this question
or