Skip to content

Commit

Permalink
Merge pull request #62 from dimabarbul/54-add-sample-of-writer-using-…
Browse files Browse the repository at this point in the history
…razor-syntax
  • Loading branch information
dimabarbul authored Jul 22, 2023
2 parents e672a04 + 541f548 commit 43ad4e4
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using XReports.Demos.Models.Shared;
using XReports.Demos.XReports;
using XReports.Html;
using XReports.Html.PropertyHandlers;
using XReports.ReportCellProperties;
using XReports.SchemaBuilders;
using XReports.Table;

Expand Down Expand Up @@ -35,7 +37,8 @@ public async Task<IActionResult> Index()
private IReportTable<ReportCell> BuildReport()
{
ReportSchemaBuilder<Entity> reportBuilder = new();
reportBuilder.AddColumn("Name", e => e.Name);
reportBuilder.AddColumn("Name", e => e.Name)
.AddProperties(new BoldProperty());
reportBuilder.AddColumn("Score", e => e.Score);

IReportTable<ReportCell> reportTable = reportBuilder.BuildVerticalSchema().BuildReportTable(this.GetData());
Expand All @@ -44,7 +47,10 @@ private IReportTable<ReportCell> BuildReport()

private IReportTable<HtmlReportCell> ConvertToHtml(IReportTable<ReportCell> reportTable)
{
ReportConverter<HtmlReportCell> htmlConverter = new(Array.Empty<IPropertyHandler<HtmlReportCell>>());
ReportConverter<HtmlReportCell> htmlConverter = new(new[]
{
new BoldPropertyHtmlHandler(),
});

return htmlConverter.Convert(reportTable);
}
Expand Down

0 comments on commit 43ad4e4

Please sign in to comment.