Load FPX Prepared Report in PreviewControl
Hello everyone!
I'm generating prepared reports and want to allow people to view the prepared reports but I can't seem to get them to load in the PreviewControl.
Has anyone done this or know what I have to do differently to do this?
I appreciate the help!
This discussion has been closed.
Comments
I figured this out so I wanted to post the solution in case anyone else needed it:
// push to fastreport
FastReport.Report report = new FastReport.Report();
//Get Directory for Reports
string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string FileString = @"\...\....\....\File.fpx";
string directoryString = appdata + FileString;
report.Load(directoryString);
report.Preview = ReportPreviewControl;
report.Prepare();
report.ShowPrepared();
report.Preview.ZoomPageWidth();
ReportPreviewControl.Update();
Hello!
To open a ready-made (.fpx) report within a PreviewControl in WinForms:
A common mistake is to try to call report.Load(...) + report.Show() (this is for the .frx template, not .fpx), or to forget to set report.Preview = previewControl1 before calling ShowPrepared()