Report loaded from string not shown in the Viewer

Stimulsoft Reports.WEB discussion
Post Reply
dsibinski
Posts: 2
Joined: Mon Sep 06, 2021 5:03 am

Report loaded from string not shown in the Viewer

Post by dsibinski »

Hi!
I'm currently investigating a migration from Reports.WPF to Reports.WEB for a customer.
Currently, we create some reports in the WPF designer and save their definitions as strings in the database.

I'm now trying to use Stimulsoft Reports.Web in our ASP.NET MVC 5 app. I installed all packages and the designer works fine, but I have issues with displaying currently-created reports in the Viewer. I followed this documentation part: https://www.stimulsoft.com/en/documenta ... report.htm

My view for the Viewer looks as follows:

Code: Select all

@using Stimulsoft.Report.Web;
@using Stimulsoft.Report.Mvc;
@using System.Web.UI.WebControls

@{
	ViewData["Title"] = "Report - Viewer";
}

@Html.Stimulsoft().StiMvcViewer("MvcViewer1", new StiMvcViewerOptions()
{
	Actions =
	{
		GetReport = "GetReportForViewer",
		ViewerEvent = "ViewerEvent"
	},
	Appearance =
	{
		ScrollbarsMode = true
	}
})
and the `GetReportForViewer` controller method:

Code: Select all

public virtual ActionResult GetReportForViewer(Guid id)
        {
            var report = new StiReport();
            var customReport = ... // getting our report object from the database
            report = new StiReport();
            report.LoadFromString(customReport.ReportDefinition); // this is our string definition of the report
            DataSet data = .. // getting some additional data for the report as DataSet object
            report.RegData("My data", data);
            report.Render(true);

            return StiMvcDesigner.GetReportResult(report);
        }
However, when I open a report in this way, the content of the report is not rendered:
Stimulsoft_empty_viewer.png
Stimulsoft_empty_viewer.png (8.89 KiB) Viewed 1296 times
As soon as I change for example the zoom from 100% to any other value, the report's content appears.

So I guess I must be missing something on the controller side to actually render the report.

In Reports.WPF we additionally call `report.ShowWithWpfRibbonGUI()`, but here it of course doesn't work. I tried calling 'report.Show()', but I got a runtime excepion then: "Assembly 'Stimulsoft.Report.Win' is not found".

Can you help me here please? :)
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Report loaded from string not shown in the Viewer

Post by Lech Kulikowski »

Hello,

Please check the following samples:
https://github.com/stimulsoft/Samples-N ... MVC-CSharp

Thank you.
dsibinski
Posts: 2
Joined: Mon Sep 06, 2021 5:03 am

Re: Report loaded from string not shown in the Viewer

Post by dsibinski »

Hi again,
thanks for answering. Finally, I solved my issue. I was using

Code: Select all

StiMvcDesigner.GetReportResult(report)
instead of

Code: Select all

StiMvcViewer.GetReportResult(report)
😉 Copy-paste issue 😀
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Report loaded from string not shown in the Viewer

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply