Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions Controllers/ExternalReportServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,109 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type,
_items.Add(catalogItem);
}
}
else if (type == ItemTypeEnum.File)
{
var dataSourceProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(targetFolder, "Files"));
foreach (var file in dataSourceProvider.GetDirectoryContents("").Where(f => !f.IsDirectory))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.File;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
catalogItem.Extension = Path.GetExtension(file.Name);
_items.Add(catalogItem);
}
}

return _items;
}

public override BoldReports.RDL.DOM.Server.ItemDefinition GetItemDefinition(string itemName)
{
try
{
if (string.IsNullOrWhiteSpace(Path.GetFileNameWithoutExtension(itemName)))
return null;

BoldReports.RDL.DOM.Server.ItemDefinition itemDefinition = new BoldReports.RDL.DOM.Server.ItemDefinition();
itemDefinition.FileContent = this.GetFileContent(itemName);
itemDefinition.FilePassword = this.GetFilePassword(itemName);
itemDefinition.Extension = Path.GetExtension(itemName);

return itemDefinition;
}
catch (Exception ex)
{
throw new InvalidOperationException($"Unable to load the report resource '{itemName}'. Please check the resource name and ensure the file exists", ex);
}

return null;
}

private string GetFilePassword(string itemName)
{
if (itemName.EndsWith(".pfx", StringComparison.OrdinalIgnoreCase))
{
string passwordFile = Path.Combine(this.basePath, "resources", "Files", "CertificateCredentials.xml");

if (File.Exists(passwordFile))
{
XmlDocument xml = new XmlDocument();
xml.Load(passwordFile);

foreach (XmlNode certNode in xml.SelectNodes("//CertificateCredentials/Certificate"))
{
if (certNode == null)
continue;

string name = certNode.SelectSingleNode("name")?.InnerText?.Trim() ?? string.Empty;
string password = certNode.SelectSingleNode("password")?.InnerText?.Trim();

if (!name.Equals(Path.GetFileNameWithoutExtension(itemName), StringComparison.OrdinalIgnoreCase))
continue;
if (!string.IsNullOrEmpty(password))
{
return password;
}

break;
}
}
}

return null;
}

private byte[] GetFileContent(string itemName)
{
string imagePath = Path.Combine(this.basePath, "resources", itemName);
string[] fileExtensions = { ".pfx", ".pdf", ".html" };

if (fileExtensions.Any(extension => itemName.EndsWith(extension, StringComparison.OrdinalIgnoreCase)))
{
imagePath = Path.Combine(this.basePath, "resources", "Files", itemName);
}
if (File.Exists(imagePath))
{
using (Stream stream = this.ReadFiles(imagePath))
{
if (stream == null)
return null;

using (MemoryStream memoryStream = new MemoryStream())
{
stream.CopyTo(memoryStream);
if (memoryStream.Length == 0)
return null;

return memoryStream.ToArray();
}
}
}

return null;
}

public override bool CreateReport(string reportName, string folderName, byte[] reportdata, out string exception)
{
return base.CreateReport(reportName, folderName, reportdata, out exception);
Expand Down
19 changes: 19 additions & 0 deletions Controllers/ReportViewer/HrPayrollController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
[Route("report-viewer/hr-payroll")]
public class HrPayrollController : PreviewController
{
[HttpGet("")]
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
Binary file removed Nuget/BoldReports.Base.Logger.11.1.10.nupkg
Binary file not shown.
Binary file added Nuget/BoldReports.Base.Logger.12.1.12.nupkg
Binary file not shown.
38 changes: 19 additions & 19 deletions ReportsCoreSamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.12.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bold.Licensing" Version="11.1.10" />
<PackageReference Include="BoldReports.AspNet.Core" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Barcode" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Signature" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Shape" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Html" Version="11.1.10">
<PackageReference Include="Bold.Licensing" Version="12.1.12" />
<PackageReference Include="BoldReports.AspNet.Core" Version="12.1.12" />
<PackageReference Include="BoldReports.CRI.Barcode" Version="12.1.12" />
<PackageReference Include="BoldReports.CRI.Signature" Version="12.1.12" />
<PackageReference Include="BoldReports.CRI.Shape" Version="12.1.12" />
<PackageReference Include="BoldReports.CRI.Html" Version="12.1.12">
<ExcludeAssets>native</ExcludeAssets>
</PackageReference>
<PackageReference Include="BoldReports.CRI.Pdf" Version="11.1.10" />
<PackageReference Include="BoldReports.Net.Core" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.WebData" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Csv" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Excel" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.ElasticSearch" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.SSAS" Version="11.1.10" />
<PackageReference Include="BoldReports.CRI.Pdf" Version="12.1.12" />
<PackageReference Include="BoldReports.Net.Core" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.WebData" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.Csv" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.Excel" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.ElasticSearch" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.SSAS" Version="12.1.12" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="PuppeteerSharp" Version="5.0.0" />
Expand All @@ -43,12 +43,12 @@
</PackageReference>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="BoldReports.Data.MySQL" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Oracle" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.PostgreSQL" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.Snowflake" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.GoogleBigQuery" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.MongoDB" Version="11.1.10" />
<PackageReference Include="BoldReports.Data.MySQL" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.Oracle" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.PostgreSQL" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.Snowflake" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.GoogleBigQuery" Version="12.1.12" />
<PackageReference Include="BoldReports.Data.MongoDB" Version="12.1.12" />
</ItemGroup>
<ItemGroup>
<None Include="Controllers\**" CopyToOutputDirectory="Always" />
Expand Down
18 changes: 17 additions & 1 deletion Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -125,6 +125,22 @@ public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
}
// Add trailing slash middleware - dynamically skip ALL API routes
app.Use(async (context, next) =>
{
var pathBase = context.Request.PathBase;
var path = context.Request.Path.Value;
string[] reportKeywords = ["report-viewer", "report-designer", "report-writer"];
bool isReportRoute = reportKeywords.Any(keyword => path.Contains(keyword, StringComparison.OrdinalIgnoreCase));
if (isReportRoute && !string.IsNullOrEmpty(path) && path != "/" && !path.EndsWith('/') && !Path.HasExtension(path) && !path.Contains("report-writer/generate", StringComparison.OrdinalIgnoreCase))
{
var query = context.Request.QueryString.Value;
var destination = $"{pathBase}{path}/{query}";
context.Response.Redirect(destination, permanent: true);
return;
}
await next();
});
app.UseMiddleware<CSRFHandler>();
app.UseResponseCompression();
app.UseFileServer();
Expand Down
23 changes: 23 additions & 0 deletions Views/HrPayroll/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@inject Globals globals;
@section control {
<bold-report-viewer id="reportviewer" report-service-url="@Globals.SERVICE_URL" report-path="hr-payroll.rdl" toolbar-rendering="onToolbarRendering" tool-bar-item-click="onToolBarItemClick" export-item-click="onExportItemClick" />
}
@section description {
<div id="description">
<p>
The HR Payroll report provides a comprehensive overview of employee compensation, departmental performance, and leave management. It helps HR teams analyze payroll trends and make informed decisions.
</p>
<ul>
<li>Displays <code>gross salary</code>, <code>net salary</code>, and <code>deductions</code> across departments.</li>
<li>Visualizes <code>Loss of Pay (LOP)</code>breakdown by leave type: sick, good, and compensation leave.</li>
<li>Includes <code>employee demographics</code> such as gender distribution and contract types.</li>
<li>Summarizes leave availability for sick and casual leave by department.</li>
<li>Highlights <code>average performance</code> and employee count per department.</li>
</ul>
<p>
For more information on how dynamic image report items enhance customization in multi-company HR reports, refer to this
<a href="https://help.boldreports.com/enterprise-reporting/designer-guide/report-designer/image-manager/"
target="_blank" rel="noreferrer">documentation</a> section.
</p>
</div>
}
17 changes: 17 additions & 0 deletions Views/MultiLanguageReport/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,31 @@
$("#update").on("click", function () {
updateViewer();
});
const tooltipLocales = {
"en-US": { header: "Edit Report", content: "Edit this report in designer" },
"fr-CA": { header: "Modifier le rapport", content: "Modifier ce rapport dans le concepteur" },
"de-DE": { header: "Bericht bearbeiten", content: "Bearbeiten Sie diesen Bericht im Designer" },
"hi-IN": { header: "रिपोर्ट संपादित करें", content: "इस रिपोर्ट को डिज़ाइनर में संपादित करें" },
"es-ES": { header: "Editar informe", content: "Editar este informe en el diseñador" },
"nl-NL": { header: "Rapport bewerken", content: "Bewerk dit rapport in de ontwerper" },
"ko-KR": { header: "보고서 편집", content: "디자이너에서 이 보고서를 편집합니다" },
"he-IL": { header: "ערוך דוח", content: "ערוך דוח זה במעצב" },
"ru-RU": { header: "Редактировать отчет", content: "Редактировать этот отчет в дизайнере" }
};
function updateViewer(){
const reportViewer = $("#reportviewer").boldReportViewer("instance");
const selectedLanguageId = languages.value.toString();
const tooltipData = tooltipLocales[selectedLanguageId];
const selectedLanguage = languagesList.find(lang => lang.languageId === selectedLanguageId);
const parameters = [{ name: 'Language', labels: [selectedLanguage.Name], values: [selectedLanguage.Name] }];
reportViewer.model.parameters = parameters;
reportViewer.reload();
reportViewer.setModel({'locale': selectedLanguageId});
const item = reportViewer.model.toolbarSettings.customGroups[0].items[0];
item.tooltip = {
header: tooltipData.header,
content: tooltipData.content
};
}
</script>
}
Expand Down
3 changes: 2 additions & 1 deletion Views/RDLC/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
List<BoldReports.Models.ReportDesigner.ReportItemExtensionsModule> extensions = new List<BoldReports.Models.ReportDesigner.ReportItemExtensionsModule>(){
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="barcode",ClassName="EJBarcode",ImageClass="customitem-barcode",DisplayName="1D Barcode",Category="Barcodes"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="matrixbarcode",ClassName="EJQRBarcode",ImageClass="customitem-qrbarcode",DisplayName="2D Barcode",Category="Barcodes"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="ESignature",ClassName="EJSignature",ImageClass="customitem-signature",DisplayName="Electronic",Category="Signature"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="ESignature",ClassName="EJSignature",ImageClass="customitem-signature",DisplayName="Electronic",Category="Signatures"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="PDFSignature",ClassName="EJPDFSignature",ImageClass="customitem-pdfsignature",DisplayName="PDF",Category="Signatures"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="Shape",ClassName="EJShape",ImageClass="customitem-shape",DisplayName="Shape",Category="Shapes"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="pdfdocument",ClassName="EJPdfDocument",ImageClass="customitem-pdfdocument",DisplayName="PDF",Category="Documents",AllowHeaderFooter=false},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="htmldocument",ClassName="EJHtmlDocument",ImageClass="customitem-htmldocument",DisplayName="Html",Category="Documents"}
Expand Down
3 changes: 2 additions & 1 deletion Views/ReportDesigner/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
List<BoldReports.Models.ReportDesigner.ReportItemExtensionsModule> extensions = new List<BoldReports.Models.ReportDesigner.ReportItemExtensionsModule>(){
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="barcode",ClassName="EJBarcode",ImageClass="customitem-barcode",DisplayName="1D Barcode",Category="Barcodes"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="matrixbarcode",ClassName="EJQRBarcode",ImageClass="customitem-qrbarcode",DisplayName="2D Barcode",Category="Barcodes"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="ESignature",ClassName="EJSignature",ImageClass="customitem-signature",DisplayName="Electronic",Category="Signature"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="ESignature",ClassName="EJSignature",ImageClass="customitem-signature",DisplayName="Electronic",Category="Signatures"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="PDFSignature",ClassName="EJPDFSignature",ImageClass="customitem-pdfsignature",DisplayName="PDF",Category="Signatures"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="Shape",ClassName="EJShape",ImageClass="customitem-shape",DisplayName="Shape",Category="Shapes"},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="pdfdocument",ClassName="EJPdfDocument",ImageClass="customitem-pdfdocument",DisplayName="PDF",Category="Documents",AllowHeaderFooter=false},
new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule{Name="htmldocument",ClassName="EJHtmlDocument",ImageClass="customitem-htmldocument",DisplayName="Html",Category="Documents"}
Expand Down
2 changes: 2 additions & 0 deletions bundleconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"wwwroot/scripts/extensions/qrbarcode.reportitem.js",
"wwwroot/scripts/extensions/signature.reportitem.js",
"wwwroot/scripts/extensions/signature.dialog.js",
"wwwroot/scripts/extensions/pdf.signature.reportitem.js",
"wwwroot/scripts/extensions/shape.reportitem.js",
"wwwroot/scripts/extensions/pdfdocument.reportitem.js",
"wwwroot/scripts/extensions/htmldocument.reportitem.js",
Expand Down Expand Up @@ -119,6 +120,7 @@
"wwwroot/extensions/barcode.reportitem.css",
"wwwroot/extensions/signature.reportitem.css",
"wwwroot/extensions/signature.dialog.css",
"wwwroot/extensions/pdf.signature.reportitem.css",
"wwwroot/extensions/shape.reportitem.css",
"wwwroot/extensions/document.reportitem.css",
"wwwroot/css/bold-reports/v2.0/tailwind-light/bold.report-viewer.min.css",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aspnet-core-samples",
"version": "11.1.10",
"version": "12.1.12",
"author": "Syncfusion",
"license": "Syncfusion",
"scripts": {
Expand Down
Loading