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

Export excel in grouping ?

2 Answers 124 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.
kannan
Top achievements
Rank 1
kannan asked on 31 Jan 2011, 06:38 AM
Hi,

I am using Export excel in RadGridView. when i am going to export excel after grouping the column, the datas are not correctly exported in the excel file.

i have used the below code:

 

 

SaveFileDialog dlgFile = new SaveFileDialog();

 

dlgFile.Filter =

 

 

"Excel files|*.xls";

 

dlgFile.DefaultExt =

 

 

"xls";

 

dlgFile.FilterIndex = 1;

 

 

 

 

if (dlgFile.ShowDialog() == true)

 

{

 

 

 

using (Stream stream = dlgFile.OpenFile())

 

{

 

 

 

GridViewExportOptions exportOptions = new GridViewExportOptions();

 

exportOptions.Format =

 

 

ExportFormat.ExcelML;

 

exportOptions.ShowColumnFooters =

 

 

true;

 

exportOptions.ShowColumnHeaders =

 

 

true;

 

exportOptions.ShowGroupFooters =

 

 

true;

 

gridview.Export(stream, exportOptions);

}

}

But my excel file displays the datas ( see the Atttached file "Image1" )
But The excel file should display the data like ( see the Atttached file "Image2" )

 

2 Answers, 1 is accepted

Sort by
0
kannan
Top achievements
Rank 1
answered on 31 Jan 2011, 07:49 AM
Hi,

 i have changed my source code . the grouped column displayed the record in footer of the row.But i have to display that value in header of the row.
when i debug the below code, the condition is false.

if(e.Element ==

 

ExportElement.GroupHeaderCell)

 

{
          // This condition is false;
}

can you please explain ?

please see the attatched file



0
Michael Rogers
Top achievements
Rank 2
answered on 08 Apr 2011, 08:56 PM
Hi Kannan,

Did you figure out what is causing this i have the same problem.

Thanks
Michael
Tags
GridView
Asked by
kannan
Top achievements
Rank 1
Answers by
kannan
Top achievements
Rank 1
Michael Rogers
Top achievements
Rank 2
Share this question
or