Posted 13 November 2020, 1:45 am EST
Hello
I’m loading a embedded report in a form, and it works fine, when it’s shown in a form, but now, I also need to export it from a background proccess, whitout showing the form.
I have tried to export from the viewer, but if I don’t show the form, the pdf is empty. If I show it, the pdf is fine. How can I do this?
Thank in advance
This is how I load de the report
Public Sub LoadReport(reporte As String, ensamblado As String, parametro As String(,))
Dim asm As Assembly
asm = Assembly.LoadFrom(ensamblado)
Dim stream As Stream = asm.GetManifestResourceStream(reporte)
UcVisualizadorReportes1.LoadDocument(stream, GrapeCity.Viewer.Common.DocumentFormat.Rdlx)
Dim parametros As GrapeCity.Viewer.Common.IParameter
Dim pc As IList(Of GrapeCity.Viewer.Common.IParameter) = New List(Of GrapeCity.Viewer.Common.IParameter)()
For i As Integer = 0 To parametro.GetLength(0) - 1
Dim param As GrapeCity.ActiveReports.Viewer.Win.ReportParameter = New GrapeCity.ActiveReports.Viewer.Win.ReportParameter(parametro(i, 0), parametro(i, 1))
pc.Insert(i, param)
Next i
UcVisualizadorReportes1.SetParametersValues(pc)
End Sub
And this is how I export the report to pdf when the form is shown
Dim p As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
p.NeverEmbedFonts = ""
p.ImageQuality = GrapeCity.ActiveReports.Export.Pdf.Section.ImageQuality.Highest
Me.Export(p, New FileInfo(dialogSave.FileName))
MessageBox.Show(dialogSave.FileName + " " + My.Resources.ExportCompleteString)