how to make header bold while export to excel

5 posts, 0 answers
  1. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 06 Dec 2012 Link to this post

    Hi,

    I need to make the header text to bold while exporting Grid to excel.

    In my page ,there no Grid control.
    So to use export option of Grid , i have created a dynamic Grid Control and binding the data to it. 

    As per requirements, i need to provide show-dialog box with a  default name (user can change name if he wants)

    Below is my code

                 AuthGridView authGridView = new AuthGridView();
                authGridView.AutoGenerateColumns = true;
                authGridView.ItemsSource = this.searchResults;

                SaveFileDialog dialog = new SaveFileDialog();
                dialog.DefaultExt = "*.xls";
                dialog.Filter = "Excel files (*.xls)|*.xls";
                dialog.DefaultFileName = DateTime.Now.ToString("yyyyMMddHHmmss");

                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 = true;      

                        authGridView.Export(stream, exportOptions);
                    }
                }

  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 06 Dec 2012 Link to this post

    Hi,

    You can tamper with the exported content form within the ElementExporting event handler.

    Kind regards,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 06 Dec 2012 Link to this post

    thanks a lot it solved my issue!!!
  5. Swetha
    Swetha avatar
    14 posts
    Member since:
    Apr 2013

    Posted 24 Jul 2013 Link to this post

    Hi Telerik Team,

    I have a table with htmltextbox in the column cells. I want to display certain texts in the table in Bold letters.
    I inserted <B> </B> tags for those rows in the table and it worked fine in pdf.
    But the htmltextbox is not displaying those rows in bold in Excel.

    Can you please help me on this?
  6. Swetha
    Swetha avatar
    14 posts
    Member since:
    Apr 2013

    Posted 26 Jul 2013 Link to this post

    I got it done. I applied a formatting rule for that particular columns and rows.
Back to Top
DevCraft banner