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

[Solved] Export to excel - cell background is ignored

3 Answers 154 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.
Alexey
Top achievements
Rank 1
Alexey asked on 14 Feb 2011, 07:07 AM
Hi! Even if i do this:

        private void gridViewCalc_ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            e.Background = Colors.LightGray;
            e.Foreground = Colors.Black;
            e.FontSize = 20;
        }

        private void calcExport_Click(object sender, RoutedEventArgs e)
        {
            if (gridViewCalc.Visibility == Visibility.Visible)
            {
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.DefaultExt = "xls";
                dialog.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";
                dialog.FilterIndex = 1;


                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;
                        gridViewCalc.Export(stream, exportOptions);
                    }
                }
            }
        }

All cells are white and it seems like default. What is wrong with my code?

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Feb 2011, 09:02 AM
Hi,

 Currently the grid can export styles only in HTML format.

Greetings,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Alexey
Top achievements
Rank 1
answered on 14 Feb 2011, 10:03 AM
0
Vlad
Telerik team
answered on 14 Feb 2011, 10:16 AM
Hi,

 In the demo the grid with styles is exported in HTML format however with XLS extension. 

Best wishes,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Alexey
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Alexey
Top achievements
Rank 1
Share this question
or