public static class SharedReportSettings
{
public static ToolbarSettings ToolbarSettings=> new ToolbarSettings()
{
Items = ToolbarItems.All,
CustomItems = new List<CustomItem>()
{
new CustomItem()
{
GroupIndex = 0,
Index = 1,
CssClass = "e-icon e-pdf-export e-reportviewer-icon",
Type = ToolBarItemType.Default,
Id = "PdfExport",
Tooltip = new ToolTip() { Header = "PDF", Content = "Eksport PDF" }
}
}
};
public static ExportSettings ExportSettings=> new ExportSettings()
{
ExportOptions = ExportOptions.All
& ~ExportOptions.Word
& ~ExportOptions.Html
& ~ExportOptions.CSV
};
}
@page "{id:int?}"
@using Components.Syncfusion
@model WEB.Gala.Pages.Reports.OrderReport
<div class="report-size">
<bold-report-viewer
report-path="OrderReport.rdlc"
id="viewer"
print-mode="true"
toolbar-settings="@SharedReportSettings.ToolbarSettings"
export-settings="@SharedReportSettings.ExportSettings"
tool-bar-item-click="onSharedToolBarItemClick"
report-service-url="/api/ReportViewer"
dataSources="@Model.DataSources"
processing-mode="Local"
print-option="NewTab"
locale="pl-PL"
is-responsive="true">
</bold-report-viewer>
</div>
function onSharedToolBarItemClick(args) {
if (args.value === "PdfExport") {
this.exportReport("Pdf");
}
}
function onSharedToolBarItemClick(args) {
if (args.value === "PdfExport") {
//HOW TO DO THAT???
//>
this.fileName='@Model.GeneratedName'
//>
this.exportReport("Pdf");
}
}
I know the solution you suggested, but unfortunately it doesn't solve my problem.
In the required business scenario, the report name should be generated based on values in DataSources of the report, and these are set up by the Razor Page model.
|
<bold-report-viewer id="viewer" ajax-before-load="onAjaxRequest" report-service-url="/api/ReportApi" export-item-click="exportAction"></bold-report-viewer>
<script type="text/javascript">
function exportAction(args) {
//return your own file name from the Razor Page model
args.fileName = "Test123";
}
</script> |
|
function exportAction(args) {
var fileName = "Test123";
var reportviewerObj = $("#viewer").data("boldReportViewer");
reportviewerObj._processExport("PDF", fileName); //Exports the report into PDF format.
}
|