This example shows how to integrate the report viewer and report designer into an application. Let's start from viewer. First, import scripts:
using Stimulsoft.Report;
using Stimulsoft.Report.Angular;
using Stimulsoft.Report.Mvc;
using Stimulsoft.Report.Web;

...

Next, initialize the viewer:
...

public ActionResult InitViewer()
{
	var requestParams = StiMvcViewer.GetRequestParams();

	var options = new StiAngularViewerOptions();
	options.Actions.GetReport = "GetReport";
	options.Actions.ViewerEvent = "ViewerEvent";
	options.Appearance.ScrollbarsMode = true;
	options.Toolbar.ShowDesignButton = true;

	return StiAngularViewer.ViewerDataResult(requestParams, options);
}
...

After that, load a report:
...

[AllowCrossSiteJson]
public ActionResult GetReport()
{
	var report = StiReport.CreateNewReport();
	var path = Server.MapPath($"~/Reports/MasterDetail.mrt");
	report.Load(path);

	return StiAngularViewer.GetReportResult(report);
}

...

Finally, process other viewer requests:
...

[AllowCrossSiteJson]
public ActionResult ViewerEvent()
{
	return StiAngularViewer.ViewerEventResult();
}

...

Now, let's continue with designer. First, import scripts:
using Stimulsoft.Report;
using Stimulsoft.Report.Mvc;
using Stimulsoft.Report.Web;

...

Next, initialize the designer:
...

[AllowCrossSiteJson]
public ActionResult Get()
{
	var requestParams = StiMvcDesigner.GetRequestParams();

	if (requestParams.Action == StiAction.Undefined)
	{
		var options = new StiMvcDesignerOptions();
		return StiMvcDesigner.GetAngularScriptsResult(requestParams, options);
	}

	if (requestParams.ComponentType == StiComponentType.Designer)
	{
		switch (requestParams.Action)
		{
			case StiAction.GetReport:
				return GetReport();

			case StiAction.SaveReport:
				return SaveReport();
		}
	}

	return StiMvcDesigner.ProcessRequestResult();
}
		
...

After that, load a report:
...

public ActionResult GetReport()
{
	var report = StiReport.CreateNewReport();
	var path = Server.MapPath("~/Reports/MasterDetail.mrt");
	report.Load(path);

	return StiMvcDesigner.GetReportResult(report);
}


...

Finally, create a method to save report:
...

public ActionResult SaveReport()
{
	var report = StiMvcDesigner.GetReportObject();

	var path = Server.MapPath("~/Reports/MasterDetail.mrt");
	report.Save(path);

	return StiMvcDesigner.SaveReportResult();
}

...

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.