Managing Report Printing and Exporting
Our sample projects and report templates can help you learn the basics of working with our products.When printing and exporting go through the viewer, you can intercept them on the server to adjust the document or its export settings.
Registering the actions. Name
Customizing export. In the export action you can read the chosen format and tune its settings before returning the result:
This gives you a hook to rename the output, apply format-specific settings (here the PDF creator string), enforce security or log activity, all while the user still exports through the familiar viewer toolbar.
Registering the actions. Name
PrintReport and ExportReport in the viewer options:@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
Actions =
{
GetReport = "GetReport",
PrintReport = "PrintReport",
ExportReport = "ExportReport",
ViewerEvent = "ViewerEvent"
}
})Customizing export. In the export action you can read the chosen format and tune its settings before returning the result:
public IActionResult ExportReport()
{
var report = StiNetCoreViewer.GetReportObject(this);
var parameters = StiNetCoreViewer.GetRequestParams(this);
report.ReportName = "MyReportName";
if (parameters.ExportFormat == StiExportFormat.Pdf)
{
var settings = (StiPdfExportSettings)StiNetCoreViewer.GetExportSettings(this);
settings.CreatorString = "My Company";
return StiNetCoreViewer.ExportReportResult(this, report, settings);
}
return StiNetCoreViewer.ExportReportResult(this, report);
}This gives you a hook to rename the output, apply format-specific settings (here the PDF creator string), enforce security or log activity, all while the user still exports through the familiar viewer toolbar.