Completed
Last Updated: 26 Nov 2015 10:51 by ADMIN
ADMIN
Dimitar
Created on: 12 Nov 2015 09:19
Category: GridView
Type: Bug Report
1
FIX. RadGridView - exception when there is a formula symbol in the column header text and the grid is exported.
To reproduce:
- Set the first column header text to "+R/S";
- Export the grid with spread export.

Workaround:
class MySpreadExportRenderer : SpreadExportRenderer
{
    public override void SetCellSelectionValue(string text)
    {
        if (text == "+R/S")
        {
            var cellSelection = typeof(SpreadExportRenderer).GetField("cellSelection", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as CellSelection;
            CellRange range = cellSelection.CellRanges.ElementAtOrDefault(0);

            CellValueFormat cvf = new CellValueFormat("@");

            var worksheet = typeof(SpreadExportRenderer).GetField("worksheet", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as Worksheet;
            worksheet.Cells[range.FromIndex.RowIndex, range.FromIndex.ColumnIndex].SetFormat(cvf);
        }
        base.SetCellSelectionValue(text);
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments