Hi,
My issue is when I try to export the RadGridView data to excel I cant compile.
Language : VB.net
Using this code snippet
getting error on this line
Dim
renderer
As
New
Telerik.WinControls.Export.SpreadExportRenderer()
image attached for better understanding.
can anyone tell me what I am doing wrong?
isn't SpreadExportRenderer member of Telerik.WinControls.Export ?
4 Answers, 1 is accepted
Hello Leon,
The spread export functionality is located in the TelerikExport.dll assembly which must be added to your project. Could you please make sure that you have the TelerikExport.dll added to your references? Please refer to the attached picture for your reference.
I hope this helps. Should you have any other questions, I will be glad to help.
Regards,
Nadya
Progress Telerik
Thanks Nadya for perfect solution.
one thing i just want to ask, since I am using MemoryStream is it possible to open the file directly? I mean saving it to windows temp file and open it from there? because currentely its not opening autometically. I can call it from windows shell but dont think that will be a ideal solution.
Thanks Nadya for perfect solution.
one thing i just want to ask, since I am using MemoryStream is it possible to open the file directly? I mean saving it to windows temp file and open it from there? because currentely its not opening autometically. I can call it from windows shell but dont think that will be a ideal solution.
[/quote]
addedd just one line at the end of the sub, it will open the file.
Process.Start(
"File Path including filename and extention"
)
Hello Leon,
Yes, it is possible to achieve this by using MemoryStream. Please refer to the following code snippet which demonstrates a similar approach:
Dim spreadExporter As GridViewSpreadExport = New GridViewSpreadExport(Me.radGridView1)
Dim stream As Stream = New MemoryStream()
spreadExporter.RunExport(stream, exportRenderer)
Dim fullPath As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Dim fileName As String = Path.Combine(fullPath, "export.xlsx")
Using fs As FileStream = New FileStream(fileName, FileMode.OpenOrCreate)
stream.Seek(0, SeekOrigin.Begin)
stream.CopyTo(fs)
End Using
Process.Start(fileName)
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Nadya
Progress Telerik