Updated report sample to follow new text style approach

This commit is contained in:
Marcin Ziąbek
2021-10-07 23:23:07 +02:00
parent e8b7f38187
commit 70e5783f0e
6 changed files with 20 additions and 18 deletions
@@ -1,5 +1,6 @@
using System;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
namespace QuestPDF.ReportSample.Layouts
@@ -24,7 +25,7 @@ namespace QuestPDF.ReportSample.Layouts
{
container
.AspectRatio(AspectRatio)
.Background("#EEEEEE")
.Background(Colors.Grey.Lighten3)
.Image(Source(Size.Zero));
}
}
@@ -48,13 +48,13 @@ namespace QuestPDF.ReportSample.Layouts
{
grid.Columns(6);
grid.Item().LabelCell().Text("Date", Typography.Normal);
grid.Item(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty, Typography.Normal);
grid.Item().LabelCell().Text("Location", Typography.Normal);
grid.Item(2).ValueCell().Text(Model.Location.Format(), Typography.Normal);
grid.Item().LabelCell().Text("Date");
grid.Item(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty);
grid.Item().LabelCell().Text("Location");
grid.Item(2).ValueCell().Text(Model.Location.Format());
grid.Item().LabelCell().Text("Comments", Typography.Normal);
grid.Item(5).ValueCell().Text(Model.Comments, Typography.Normal);
grid.Item().LabelCell().Text("Comments");
grid.Item(5).ValueCell().Text(Model.Comments);
});
}
}
@@ -30,11 +30,11 @@ namespace QuestPDF.ReportSample.Layouts
{
stack.Item().EnsureSpace(25).Row(row =>
{
row.ConstantColumn(150).LabelCell().Text(part.Label, Typography.Normal);
row.ConstantColumn(150).LabelCell().Text(part.Label);
var frame = row.RelativeColumn().ValueCell();
if (part is ReportSectionText text)
frame.ShowEntire().Text(text.Text, Typography.Normal);
frame.ShowEntire().Text(text.Text);
if (part is ReportSectionMap map)
frame.Element(x => MapElement(x, map));
@@ -51,7 +51,7 @@ namespace QuestPDF.ReportSample.Layouts
{
if (model.ImageSource == null || model.Location == null)
{
container.Text("No location provided", Typography.Normal);
container.Text("No location provided");
return;
}
@@ -60,7 +60,7 @@ namespace QuestPDF.ReportSample.Layouts
stack.Spacing(5);
stack.Item().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image);
stack.Item().Text(model.Location.Format(), Typography.Normal);
stack.Item().Text(model.Location.Format());
});
}
@@ -68,7 +68,7 @@ namespace QuestPDF.ReportSample.Layouts
{
if (model.Photos.Count == 0)
{
container.Text("No photos", Typography.Normal);
container.Text("No photos");
return;
}
@@ -68,8 +68,8 @@ namespace QuestPDF.ReportSample.Layouts
{
grid.Item().Text(text =>
{
text.Span($"{field.Label}: ", Typography.Normal.SemiBold());
text.Span(field.Value, Typography.Normal);
text.Span($"{field.Label}: ", TextStyle.Default.SemiBold());
text.Span(field.Value);
});
}
});
@@ -41,9 +41,9 @@ namespace QuestPDF.ReportSample.Layouts
.InternalLink(locationName)
.Row(row =>
{
row.ConstantColumn(25).Text($"{number}.", Typography.Normal);
row.RelativeColumn().Text(locationName, Typography.Normal);
row.ConstantColumn(150).AlignRight().Text(text => text.PageNumberOfLocation(locationName, Typography.Normal));
row.ConstantColumn(25).Text($"{number}.");
row.RelativeColumn().Text(locationName);
row.ConstantColumn(150).AlignRight().Text(text => text.PageNumberOfLocation(locationName));
});
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
using QuestPDF.Helpers;
using System;
using QuestPDF.Helpers;
namespace QuestPDF.Infrastructure
{