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

Export to Excel DateFormat

6 Answers 76 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GOURVEZ JJ
Top achievements
Rank 1
GOURVEZ JJ asked on 16 Mar 2012, 03:41 PM
Hi,

I use radgridview and I want export to Excel.

All it's ok with your demo, but I want change dateformat.

Does it possible ?

And I have an other question, when I export in Excel format, "return at row" fonction is activate. Does it possible do deactivate function ?

Thanks

6 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 16 Mar 2012, 03:43 PM
Hello,

Regarding your first question : You can handle the ElementExporting event. Inside the event handler you can manipulate the data to be sent to the export stream including applying different formatting.

Regarding your second question :
I am not sure what do you mean by "return at a row " function . Can you please elaborate ?

All the best,
Pavel Pavlov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
GOURVEZ JJ
Top achievements
Rank 1
answered on 16 Mar 2012, 03:48 PM
Thanks for your answer

For my second question, is "wrap text" option in Excel.
I want deactivate it.

Thanks
0
GOURVEZ JJ
Top achievements
Rank 1
answered on 19 Mar 2012, 09:28 AM
nobody ?
0
GOURVEZ JJ
Top achievements
Rank 1
answered on 19 Mar 2012, 10:26 PM
Hi,

Do you have an example to export date format ?
Because I don't find.

And does it possible to resize width column in ElementExporting event ?

Thanks

0
Pavel Pavlov
Telerik team
answered on 21 Mar 2012, 03:11 PM
Hello,

Here is some sample c# code. It illustrates where and how to control the width and format the value:
public MainPage()
        {
            InitializeComponent();
             
            this.RadGridView1.ElementExporting += new EventHandler<GridViewElementExportingEventArgs>(RadGridView1_ElementExporting);
        }



void
RadGridView1_ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            if (e.Element == ExportElement.Cell)
            {
                var column = e.Context as GridViewDataColumn;
 
                if (column.UniqueName == "MyDateColumn")
                {
                    e.Width = 400;
                    e.Value = //format the value of the cell here
                }
            }
        }


Greetings,
Pavel Pavlov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
GOURVEZ JJ
Top achievements
Rank 1
answered on 22 Mar 2012, 10:14 AM
Hi,

I have problem with format value.

This is my code :

e.Value =

 

String.Format("{0:dd/MM/yy}", e.Value);

 


Can you help me ?

thanks
Tags
GridView
Asked by
GOURVEZ JJ
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
GOURVEZ JJ
Top achievements
Rank 1
Share this question
or