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

Export To excel

5 Answers 147 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sarah
Top achievements
Rank 1
Sarah asked on 23 Mar 2012, 05:31 PM
Hi,
I have a rad grid view in my web page(Silverlight), along with certain other components such as the text blocks, grid etc.I would like to know whether is it possible to export the other components to excel along with the rad grid view onto the same excel sheet??
For exporting the rad grid view to excel i use the following code,
   string extension = "xls";
                    string selectedItem = "Excel";
                    ExportFormat format = ExportFormat.ExcelML;
 
                    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 options = new GridViewExportOptions();
                            options.Format = format;
                            options.ShowColumnHeaders = true;
                            options.Encoding = Encoding.UTF8;
                            options.ShowColumnHeaders = true;
                             
                               myRadGridview.Export(stream, options);
}
and also I know I can export the other components as images using the following code,
SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = "Excel File| *.xls";
            dialog.DefaultExt = "xls";
 
            if (dialog.ShowDialog() == true)
            {
                using (Stream file = dialog.OpenFile())
                {
                    Telerik.Windows.Media.Imaging.ExportExtensions.ExportToExcelMLImage(myStackPanel, file);
 
                }
            }
My question is can i do both on to the same excel sheet? I mean i want both the rad grid view and the stack panel which contains text blocks on to the same excel sheet, is this possible? If so how do i go about it? Thank you in advance!

5 Answers, 1 is accepted

Sort by
0
Sarah
Top achievements
Rank 1
answered on 11 Apr 2012, 07:33 PM
Telerik team,
Kindly reply! At-least let me know whether this is possible for not. Do care to reply!
0
Houdini
Top achievements
Rank 1
answered on 13 Apr 2012, 06:55 PM
Could you please say how I could ALLOW whitespaces in my export using
ExportFormat format = ExportFormat.Html;

How do I maintain the spaces in my GrdiView over to my excel file. It always merges all the white spaces in one when using the html format. I want to disable that, but I can't find anywhere to disable HtmlEncoding or anything like that. Could you kindly help me out.

/*
Houdini
*/
0
Scatterbrain
Top achievements
Rank 1
answered on 14 May 2012, 03:15 PM
Hello,
I have the same problem.. Does anyone know the solution?
0
Srikanth
Top achievements
Rank 1
answered on 27 Jul 2012, 09:35 PM
Yeah, I'm encountering the same thing - "whitspaces" being merged when exporting in html format. Telerik can you help out?
0
Nick
Telerik team
answered on 01 Aug 2012, 08:10 AM
Hello,

Would it be possible to specify which whitespaces is the problem related to? A visual sample/screenshot would help a lot.

Looking forward to hearing from you! 

Kind regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Sarah
Top achievements
Rank 1
Answers by
Sarah
Top achievements
Rank 1
Houdini
Top achievements
Rank 1
Scatterbrain
Top achievements
Rank 1
Srikanth
Top achievements
Rank 1
Nick
Telerik team
Share this question
or