I am facing an issue with Radgrid while exporting to excel. The <BR> tag not creating a new line in the excel instead it take it as a BR text. Please help
3 Answers, 1 is accepted
0
Accepted
Kostadin
Telerik team
answered on 19 Nov 2012, 09:16 AM
Hi Prabeesh,
Could you specify which export method you are using? If you are using ExcelML then instead <br> tag you should use "
", because that is the code for the new row. The following code snippet demonstrates how you could replace the <br> tags into the excel document.
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.
Thank You.
Above solution worked but along with the word wrap style.
Add style in ExcelMLExportStylesCreated
Telerik.Web.UI.GridExcelBuilder.StyleElement StyleElement = new Telerik.Web.UI.GridExcelBuilder.StyleElement();
StyleElement.Id = "brstyle";
StyleElement.AlignmentElement.Attributes["ss:WrapText"] = "1";
and apply it for the cell in the ExcelMLExportRowCreated event
If your using the Biff Excel format to avoid the Excel error on opening the Excel file, you can use this solution. Add OnBiffExporting="grid_OnBiffExporting" client side and the method below server side.