Last Updated: 14 Oct 2021 09:17 by ADMIN
Release R3 2021 SP1
Created on: 21 Sep 2021 11:47
Category: GridView
Type: Bug Report
RadGridView: GridViewSpreadStreamExport throws an error "System.ArgumentOutOfRangeException: value should be greater or equal than 0 and less or equal than 409"

Please use the attached sample project.

1 comment
Dess | Tech Support Engineer, Principal
Posted on: 21 Sep 2021 11:50

Hi, Frank,

The possible solution that I can suggest is to limit the row height to the Excel limit, 409 points.

    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click 
        Dim _exporter As New GridViewSpreadStreamExport(Me.RadGridView1)
        _exporter.ExportVisualSettings = True
        Dim fileName = "..\..\exportedFile" & DateTime.Now.ToLongTimeString().Replace(":", "_") & ".xlsx"
        _exporter.RunExport(fileName, New CustomSpreadStreamExportRenderer())
    End Sub

    Public Class CustomSpreadStreamExportRenderer
        Inherits SpreadStreamExportRenderer
        Public Overrides Sub SetRowHeight(height As Double, inPixels As Boolean)
            Dim maxRowHeight = 409 
            If height > maxRowHeight Then
                height = maxRowHeight
                inPixels = False
            End If
            MyBase.SetRowHeight(height, inPixels)
        End Sub
    End Class

I hope this information helps. 

Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.