Winforms: RadgridView export to excel

3 posts, 1 answers
  1. evan
    evan avatar
    7 posts
    Member since:
    Jun 2019

    Posted 05 Oct Link to this post

    Hi,

    I'm using Telerik version 2020.3.918.1, in Visual Studio version 16.1.1, and getting the following error when trying to export a radgridview to excel in VB.net: 

    System Entry Point Not Found. 

    on the line:          spreadExporter.RunExport(fileName, exportRenderer)

    I am able to export using Telerik export process using a solution that Dess provided on another thread, but it was in C#.    When I change the code to VB, and use the same references, I get this error.   I get the same error when I create a quick project from scratch (add a grid, load it, add references, and export...)   (Code below)

    Any ideas?   Thanks, Evan 

     

    References include:  Telerik.WinControls, Telerik.WinControls.GridView, Telerik.WinControls.UI, Telerik.Common, and Telerik.Export

    -----------------------------------------------------------------------------------------------

    Imports Telerik.WinControls.Export

      Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            'Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(RadGridView1)
            'Dim exportRenderer As New SpreadExportRenderer()
            'spreadExporter.RunExport("exportedFile.xlsx", exportRenderer)

            'Dim exportFile As String = "..\..\exportedData.xlsx"
            'Using ms As New System.IO.MemoryStream()
            '    Dim exporter As New Telerik.WinControls.Export.GridViewSpreadExport(Me.RadGridView1)
            '    Dim renderer As New Telerik.WinControls.Export.SpreadExportRenderer()
            '    exporter.RunExport(ms, renderer)

            '    Using fileStream As New System.IO.FileStream(exportFile, FileMode.Create, FileAccess.Write)
            '        ms.WriteTo(fileStream)
            '    End Using
            'End Using

            Dim fileName As String = "..\..\exported" & DateTime.Now.ToLongTimeString().Replace(":", "_") & ".xlsx"
            Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(Me.RadGridView1)
            Dim exportRenderer As SpreadExportRenderer = New SpreadExportRenderer()
            'exportRenderer.WorkbookCreated += exportRenderer_WorkbookCreated
            spreadExporter.ExportVisualSettings = True
            spreadExporter.RunExport(fileName, exportRenderer)
            Process.Start(fileName)

        End Sub


     

  2. Answer
    Nadya
    Admin
    Nadya avatar
    389 posts

    Posted 07 Oct Link to this post

    Hello, Evan,

    I would like to note that the latest Telerik version is 2020.3.915. After installing the Telerik UI for WinForms suite, you will notice the following assemblies - one for .NET 2.0, one for .NET 4.0 or higher, one for .NET Core, and one for .NET 5.0. The suffix (.20, .40, etc.) indicates the assembly version. Please refer to the following article for more information: https://docs.telerik.com/devtools/winforms/installation-and-upgrades/assemblies-version 

    It seems that you refer to some wrong references since version "2020.3.918.1" does not exist in Telerik UI for Winforms suite. Could you please make sure that you refer to the dlls from your latest installation folder for Telerik UI for Winforms? The following topic will show you how to use a specific version of the Telerik UI for WinForms suite in your project: https://docs.telerik.com/devtools/winforms/installation-and-upgrades/updating-assemblies-in-a-project 

    Telerik.WinControls, Telerik.WinControls.GridView, Telerik.WinControls.UI, Telerik.Common, and Telerik.Export are the right references that are necessary to be included in the project. 

    I have found another thread that you opened on the same topic here. The attached project is in VB. Could you please download it, add the above-mentioned references, and let me know if the error still exists on your end. I have tested it with the latest Telerik version  2020.3.915 and it works fine.

    I am looking forward to your reply.

    Regards,
    Nadya
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

  3. evan
    evan avatar
    7 posts
    Member since:
    Jun 2019

    Posted 07 Oct in reply to Nadya Link to this post

    Hi Nadya- 

    Thanks very much for finding my prior request- I knew I had asked previously but couldn't find it.   I grabbed the project you provided, tweaked the references as you recommended, and it worked.   I then went into my current project, changed the export dll reference from the xx.20 version to the xx.40 version and it works.   Thank you so much- this will make a big difference to everyone involved.  

     

Back to Top