Export To excel

6 posts, 0 answers
  1. Sarah
    Sarah avatar
    13 posts
    Member since:
    Nov 2011

    Posted 23 Mar 2012 Link to this post

    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!
  2. Sarah
    Sarah avatar
    13 posts
    Member since:
    Nov 2011

    Posted 11 Apr 2012 Link to this post

    Telerik team,
    Kindly reply! At-least let me know whether this is possible for not. Do care to reply!
  3. Houdini
    Houdini avatar
    9 posts
    Member since:
    Feb 2012

    Posted 13 Apr 2012 Link to this post

    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
    */
  4. Scatterbrain
    Scatterbrain avatar
    3 posts
    Member since:
    May 2012

    Posted 14 May 2012 Link to this post

    Hello,
    I have the same problem.. Does anyone know the solution?
  5. Srikanth
    Srikanth avatar
    1 posts
    Member since:
    Jul 2012

    Posted 27 Jul 2012 Link to this post

    Yeah, I'm encountering the same thing - "whitspaces" being merged when exporting in html format. Telerik can you help out?
  6. Nick
    Admin
    Nick avatar
    593 posts

    Posted 01 Aug 2012 Link to this post

    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.

Back to Top