How to export data from RadGridView to any location

3 posts, 0 answers
  1. Ricardo
    Ricardo avatar
    22 posts
    Member since:
    Dec 2018

    Posted 03 Jan 2019 Link to this post

    Hello, administrator

    As you know,I used the following code to export the data in the table, but how can I export the data to any location on the computer and name it instead of having to change it when the code is written

        Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(radGridView1)

        Dim exportRenderer As New SpreadExportRenderer()

        spreadExporter.RunExport("D:\exportedFile.xlsx", exportRenderer)

    Looking forward to your reply

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3903 posts

    Posted 08 Jan 2019 Link to this post

    Hello, Ricardo,  
     
    You can use the standard MS SaveFileDialog in order to give the opportunity the user to select the file location for the exported data. You can find below a sample code snippet:

    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        Dim sfd As New SaveFileDialog()
        sfd.Filter = "Excel Files (*.xlsx*)|*.xlsx"
        If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(RadGridView1)
     
            Dim exportRenderer As New SpreadExportRenderer()
     
            spreadExporter.RunExport(sfd.FileName, exportRenderer)
        End If
        Process.Start(sfd.FileName)
    End Sub

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Ricardo
    Ricardo avatar
    22 posts
    Member since:
    Dec 2018

    Posted 09 Jan 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Sr.

    Thank you very much for your help. My question has been well solved and your answer is of great help to me

Back to Top