Cloud
Cloud-Dienstleistung für schnelle und effektive Analyse und Visualisierung von Daten für Ihr Business ohne eigene Applikationen zu erstellen oder zu programmieren.
StiMvcReportResponse class. This class implements the static methods for dashboard exporting and printing that take the input of all the necessary parameters for configuration. For example, add a link for print and three links for various export formats:
<div class="row">
<div class="col-md-4">
<h2>Print to PDF</h2>
<p>@Html.ActionLink("Print", "PrintPdf")</p>
</div>
<div class="col-md-4">
<h2>Print to HTML</h2>
<p>@Html.ActionLink("Print", "PrintHTML")</p>
</div>
</div>
<hr />
<div class="row">
<div class="col-md-4">
<h2>Export to PDF</h2>
<p>@Html.ActionLink("Export", "ExportPdf")</p>
</div>
<div class="col-md-4">
<h2>Export to Excel</h2>
<p>@Html.ActionLink("Export", "ExportExcel")</p>
</div>
<div class="col-md-4">
<h2>Export to Image</h2>
<p>@Html.ActionLink("Export", "ExportImage")</p>
</div>
</div>
GetDashboard() method was used. This method creates the new dashboard object and loads the dashboard template from the file:
private StiReport GetDashboard()
{
var reportPath = Server.MapPath("~/Dashboards/DashboardChristmas.mrt");
var report = StiReport.CreateNewDashboard();
report.Load(reportPath);
return report;
}
PrintPdf and PrintHTML method:
public ActionResult PrintPdf()
{
var report = this.GetDashboard();
return StiMvcReportResponse.PrintAsPdf(report);
}
public ActionResult PrintHtml()
{
var report = this.GetDashboard();
return StiMvcReportResponse.PrintAsHtml(report);
}
ExportPdf, ExportExcel, and ExportImage. These export formats are taken for example. Also, the methods of exporting a dashboard (and printing) can take, as input, export settings and other necessary parameters:
public ActionResult ExportPdf()
{
var report = this.GetDashboard();
return StiMvcReportResponse.ResponseAsPdf(report);
}
public ActionResult ExportExcel()
{
var report = this.GetDashboard();
return StiMvcReportResponse.ResponseAsExcel2007(report);
}
public ActionResult ExportImage()
{
var report = this.GetDashboard();
return StiMvcReportResponse.ResponseAsPng(report);
}