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

keeping the format of rows in export to excel of hierachical Grid

6 Answers 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Manishkumar
Top achievements
Rank 1
Manishkumar asked on 06 Aug 2012, 12:21 PM
Hi,
I'm exporting hierarchical grid to Excel.
The problem is that while exporting the grid it's loosing the formatting of the Cells like Background color which i have set in

ItemDataBound event depending upon some condition.But in export to excel its not get persited.
Is there any way to achive this?

 




Thanks.    

6 Answers, 1 is accepted

Sort by
0
Manishkumar
Top achievements
Rank 1
answered on 08 Aug 2012, 09:39 AM
Hi telerik,
        Can you please provide the solution ASAP. As its urgent.
0
Eyup
Telerik team
answered on 13 Aug 2012, 10:43 AM
Hello Manishkumar,

I believe it will be very helpful if you check out the following article which describes the requested functionality
 Word/Excel Export (HTML-Based)

In addition, you could refer to the articles below for preserving appearance and images on PDF exporting:
Grid / Export to PDF
PDF Export

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Manishkumar
Top achievements
Rank 1
answered on 14 Aug 2012, 01:43 PM
Hi,
   If we will use the below formatting,
 

  RadGrid1.ExportSettings.Excel.Format = Telerik.Web.UI.

 

GridExcelExportFormat.ExcelML;

 


Then it will not call the the event,

 

 

protected void RadGrid1_ExportCellFormating(object source, ExcelExportCellFormattingEventArgs e)

We want to use "ExcelML" format as we are exporting Hierarchical Grid.

Please provide solution.

 

0
Eyup
Telerik team
answered on 15 Aug 2012, 09:47 AM
Hi Manishkumar,

In such case, you will need to use the ExcelMLExportStylesCreated server event. Please check out the following demo and its related help topic to get a practical idea of the suggested approach:
 Grid / Export to ExcelML

I hope this will prove helpful.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Manishkumar
Top achievements
Rank 1
answered on 16 Aug 2012, 09:34 AM
Hi
 Thanks for help. But I have certain conditions which i need to check before applying colors to item.
Like

 

 

if (item.OwnerTableView.Name.Equals("Task"))

 

{

 

 

if (item["BSD_COLOR"].Text == "R")

 

{

item[

 

"BASELINE_START_DATE"].BackColor = Color.Red;

 

}

 

 

else if (item["BSD_COLOR"].Text == "G")

 

{

item[

 

"BASELINE_START_DATE"].BackColor = Color.Green;

 

}

 

 

 

if (item["BFD_COLOR"].Text == "R")

 

{

item[

 

"BASELINE_FINISH_DATE"].BackColor = Color.Red;

 

}

 

 

else if (item["BFD_COLOR"].Text == "G")

 

{

item[

 

"BASELINE_FINISH_DATE"].BackColor = Color.Green;

 

}

}

 

 

if (item.OwnerTableView.Name.Equals("SubTask"))

 

{

item[

 

"BASELINE_START_DATE"].BackColor = GetColorForBSDSubTask(item["BASELINE_START_DATE"].Text, item["actual_start_date"].Text);

 

item[

 

"BASELINE_FINISH_DATE"].BackColor = GetColorForBFDSubTask(item["BASELINE_FINISH_DATE"].Text, item["ACTUAL_FINISH_DATE"].Text, item["ESTIMATED_COMPLETION_DATE"].Text);

 

}

 

 

 

 

like this. but in "RadGrid_

 

ExcelMLExportRowCreated(

 

object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e)" ,we are not able to get Items.

Please Suggest.

 

0
Eyup
Telerik team
answered on 21 Aug 2012, 10:29 AM
Hi Manishkumar,

I am afraid there is no direct way to access the corresponding GridDataItem to the current RowElement in the mentioned server event. You will need to manually customize the cells' styles in accordance with their data values.

I have created a sample RadGrid web site to demonstrate the suggested approach. Please check out the attached application and try to implement it within your own project.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Manishkumar
Top achievements
Rank 1
Answers by
Manishkumar
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or