Unplanned
Last Updated: 20 Mar 2018 08:30 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 19 Mar 2018 09:23
Category: GridView
Type: Bug Report
1
FIX. RadGridView - exported summary item's value is not considered as a number in Excel
To reproduce:  run the attached sample project and click the 'export' button. The exported file fill be automatically opened. If you select several cells from the UnitPrice column you will see at the bottom that the cell values ' total is displayed. However, if you include  the summary item's value in the selection its value is not taken into consideration.  If you pay attention to the cell's format, it will be General instead of custom numeric one.

Workaround: 

    Private Sub spreadExporter_CellFormatting(sender As Object, e As Telerik.WinControls.Export.CellFormattingEventArgs)
        If e.GridRowInfoType = GetType(GridViewSummaryRowInfo) AndAlso e.GridCellInfo.ColumnInfo.Name = "DecimalColumn" Then
            Dim cellSelection As CellSelection = TryCast(e.CellSelection, CellSelection)
            Dim cellFormat As New CellValueFormat("### ### ###.00")
            If cellFormat IsNot Nothing Then
                cellSelection.SetValue(Decimal.Parse(cellSelection.GetValue().Value.RawValue.Replace(" ", "")))
                cellSelection.SetFormat(cellFormat)
            End If 
        End If 
    End Sub
0 comments