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

New line on cell of exported excel

1 Answer 336 Views
Grid
This is a migrated thread and some comments may be shown as answers.
victor
Top achievements
Rank 1
victor asked on 26 Mar 2011, 12:18 AM
Hi,
I'm exporting a RadGridview to excel, the only thing that I need is add a new line inside some cells,
the value inside the cell has \t \n but when I export the excel I get something like this <br> inside my excel file.






I'm using the following to change from \t \n to <br> but It doesn't work
        
    if (e.Element == ExportElement.Cell )
            {
                e.Value = e.Value.ToString().Replace("\t \n",  " <br>  ");  
            }

what is the corret way to do it.

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 Mar 2011, 03:53 PM
Hello Victor,

Please try to replace the newline characters on GridExporting as shown below:
protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
    e.ExportOutput = e.ExportOutput.Replace(NewLineCharacter, "&#10;");
}

Kind regards,
Daniel
the Telerik team
Tags
Grid
Asked by
victor
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or