This is a migrated thread and some comments may be shown as answers.

problem exporting report to PDF

2 Answers 295 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 01 May 2014, 11:07 AM
Dear All,

For some days now I am struggling with a problem to export my report to PDF.
using the command  "ReportViewer2.ExportReport("PDF", deviceInfo)" there is no problem but I want to name the report  and the location dynamically.

using this code

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim savepath As String
        Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()

        'set any deviceInfo settings if necessary
        Dim deviceInfo As New System.Collections.Hashtable()

        Dim typeReportSource As New Telerik.Reporting.TypeReportSource()

        ' reportName is the Assembly Qualified Name of the report
        typeReportSource.TypeName = "Factuur3"

        Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo)
        Dim fileName As String = result.DocumentName + "." + result.Extension
        Dim path As String = System.IO.Path.GetTempPath()
        Dim filePath As String = System.IO.Path.Combine(path, fileName)

        Using fs As New System.IO.FileStream(filePath, System.IO.FileMode.Create)
            fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length)
        End Using


        savepath = "c\testdir\facturen\"

    End Sub

is giving me an error "Invalid reporttype"

Anyone any suggestions?


2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 02 May 2014, 01:23 PM
Hello Juan,

The "Invalid reporttype" error is thrown, most probably beacuse the typeReportSource.TypeName = "Factuur3" is not a valid Assembly Qualified Name. In order to be sure that the assembly qualified name is correct, please use the Type.AssemblyQualifiedName property instead of writing the string manually i.e.:
typeReportSource.TypeName = GetType(Factuur3).AssemblyQualifiedName


Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Juan
Top achievements
Rank 1
answered on 02 May 2014, 02:00 PM
Dear Nasko,

Thnx verry much!
This solved the problem!!

Juan
Tags
General Discussions
Asked by
Juan
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Juan
Top achievements
Rank 1
Share this question
or