Cloud
Облачный сервис для быстрого и эффективного анализа и визуализации данных для вашего бизнеса без необходимости создания своих приложений и программирования.
StiMvcViewer component to the Viewer view page. Also you need to pass the StiMvcViewerOptions object to the constructor. The minimum required options are two actions - GetReport and ViewerEvent, they are located in the Actions options group:
@using Stimulsoft.Report.Mvc;
@using Stimulsoft.Report.Web
...
@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Actions =
{
GetReport = "GetReport",
ViewerEvent = "ViewerEvent"
},
Appearance =
{
FullScreenMode = true,
ScrollbarsMode = true
},
Toolbar =
{
DisplayMode = StiToolbarDisplayMode.Separated
}
})
StiMvcDesigner component to the Designer view page. Also you need to pass the StiMvcDesignerOptions object to the constructor. The minimum required options are two actions - GetReport and DesignerEvent. For the ability to preview and save the report, specify the PreviewReport and SaveReport actions:
@using Stimulsoft.Report.Mvc;
...
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions()
{
Actions =
{
GetReport = "GetReport",
PreviewReport = "PreviewReport",
SaveReport = "SaveReport",
DesignerEvent = "DesignerEvent"
}
})
<h2>Using the Viewer and Designer in One Project</h2>
<br />
@Html.ActionLink("Design Report", "Designer")
<br /><br />
@Html.ActionLink("View Report", "Viewer")
GetReport action loads the report and returns the response to the client part of the viewer using the GetReportResult() static method. In the parameters of this method, the report object should be passed. For example, load the rendered report file:
public ActionResult GetReport()
{
var report = new StiReport();
report.Load(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt"));
return StiMvcViewer.GetReportResult(report);
}
ViewerEvent action handles all the viewer events (switching pages, zooming, printing, exporting, interactivity, etc.) and returns the response to the client using the ViewerEventResult() static method:
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult();
}
GetReport action loads the report template and returns the response to the client part of the designer using the GetReportResult() static method. In the parameters of this method, the report object should be passed:
public ActionResult GetReport()
{
var report = new StiReport();
report.Load(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt"));
report.Dictionary.Databases.Clear();
return StiMvcDesigner.GetReportResult(report);
}
PreviewReport action will be invoked when you open the preview report tab in the designer. In this action, you can get the report object and perform any action, for example connect to data. To prepare the answer for the client you should use the PreviewReportResult() static method. In the parameters of this method, the report object should be passed:
public ActionResult PreviewReport()
{
var data = new DataSet("Demo");
data.ReadXml(Server.MapPath("~/Content/Data/Demo.xml"));
var report = StiMvcDesigner.GetActionReportObject();
report.RegData(data);
return StiMvcDesigner.PreviewReportResult(report);
}
SaveReport action will be invoked when you press on the Save button in the designer. In this action, save the report template in the same file that was loaded when start the designer. Also this file is loaded in the GetReport action of the viewer. To prepare the answer for the client you should use the SaveReportResult() static method:
public ActionResult SaveReport()
{
var report = StiMvcDesigner.GetReportObject();
report.Save(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt"));
return StiMvcDesigner.SaveReportResult();
}
DesignerEvent action handles all the designer events (adding and editing report components, work with the data dictionary, switch pages, zooming, etc.) and returns the answer to the client using the DesignerEventResult() static method:
public ActionResult DesignerEvent()
{
return StiMvcDesigner.DesignerEventResult();
}
public ActionResult Designer()
{
return RedirectToAction("Index", "Designer");
}
public ActionResult Viewer()
{
return RedirectToAction("Index", "Viewer");
}