Files

80 lines
2.5 KiB
C#
Raw Permalink Normal View History

2022-03-20 01:53:51 +01:00
using Avalonia.Media;
using QuestPDF.Fluent;
2022-03-16 22:54:03 +01:00
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
using QuestPDF.Previewer;
2022-03-21 01:02:53 +01:00
using QuestPDF.ReportSample;
using QuestPDF.ReportSample.Layouts;
2022-03-20 01:53:51 +01:00
using Colors = QuestPDF.Helpers.Colors;
2022-03-16 22:54:03 +01:00
var model = DataSource.GetReport();
var report = new StandardReport(model);
report.ShowInPreviewer();
2022-03-21 01:02:53 +01:00
return;
2022-03-16 22:54:03 +01:00
Document
.Create(container =>
{
container.Page(page =>
{
page.Size(PageSizes.A4);
page.Margin(2, Unit.Centimetre);
page.PageColor(Colors.White);
page.DefaultTextStyle(x => x.FontSize(20));
page.Header()
.Text("Hot Reload!")
.SemiBold().FontSize(36).FontColor(Colors.Blue.Darken2);
page.Content()
.PaddingVertical(1, Unit.Centimetre)
.Column(x =>
{
x.Spacing(20);
2022-03-17 12:05:27 +01:00
x.Item().Table(t =>
{
t.ColumnsDefinition(c =>
{
c.RelativeColumn();
c.RelativeColumn(3);
});
2022-03-16 22:54:03 +01:00
2022-03-17 12:05:27 +01:00
t.Cell().Border(1).Background(Colors.Grey.Lighten3).Padding(5).Text("Visual Studio");
t.Cell().Border(1).Padding(5).Text("Start in debug mode with 'Hot Reload on Save' enabled.");
t.Cell().Border(1).Background(Colors.Grey.Lighten3).Padding(5).Text("Command line");
t.Cell().Border(1).Padding(5).Text("Run 'dotnet watch'.");
});
x.Item().Text("Modify this line and the preview should show your changes instantly.");
2022-03-16 22:54:03 +01:00
});
page.Footer()
.AlignCenter()
.Text(x =>
{
x.Span("Page ");
x.CurrentPageNumber();
});
});
2022-03-20 01:53:51 +01:00
container.Page(page =>
{
2022-03-21 01:02:53 +01:00
page.Size(PageSizes.A4);
2022-03-20 01:53:51 +01:00
page.Margin(2, Unit.Centimetre);
2022-03-21 01:02:53 +01:00
page.PageColor(Colors.Red.Medium);
2022-03-20 01:53:51 +01:00
page.DefaultTextStyle(x => x.FontSize(20));
page.Content()
.PaddingVertical(1, Unit.Centimetre)
.Column(x =>
{
x.Spacing(20);
foreach (var i in Enumerable.Range(0, 10))
x.Item().Background(Colors.Grey.Lighten2).Height(80);
});
});
2022-03-16 22:54:03 +01:00
})
.ShowInPreviewer();