|
|
@@ -23,19 +23,59 @@ public class MultiColumnExamples
|
|
|
container
|
|
|
.Padding(25)
|
|
|
.DefaultTextStyle(x => x.FontSize(8))
|
|
|
- .MultiColumn(4, 30)
|
|
|
- .Column(column =>
|
|
|
+ .MultiColumn(multiColumn =>
|
|
|
{
|
|
|
- column.Spacing(10);
|
|
|
+ multiColumn.Columns(3);
|
|
|
+
|
|
|
+ multiColumn
|
|
|
+ .Content()
|
|
|
+ .Column(column =>
|
|
|
+ {
|
|
|
+ column.Spacing(10);
|
|
|
|
|
|
- foreach (var sectionId in Enumerable.Range(0, 10))
|
|
|
- {
|
|
|
- foreach (var textId in Enumerable.Range(0, Random.Shared.Next(5, 10)))
|
|
|
- column.Item().Text(Placeholders.Paragraph());
|
|
|
+ foreach (var sectionId in Enumerable.Range(0, 10))
|
|
|
+ {
|
|
|
+ foreach (var textId in Enumerable.Range(0, Random.Shared.Next(5, 10)))
|
|
|
+ column.Item().Text(Placeholders.Paragraph());
|
|
|
|
|
|
- foreach (var blockId in Enumerable.Range(0, Random.Shared.Next(5, 10)))
|
|
|
- column.Item().Width(50 + blockId * 5).Height(50).Background(Placeholders.BackgroundColor());
|
|
|
- }
|
|
|
+ foreach (var blockId in Enumerable.Range(0, Random.Shared.Next(5, 10)))
|
|
|
+ column.Item().Width(50 + blockId * 5).Height(50).Background(Placeholders.BackgroundColor());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void Decoration()
|
|
|
+ {
|
|
|
+ RenderingTest
|
|
|
+ .Create()
|
|
|
+ .PageSize(PageSizes.A4)
|
|
|
+ .ProducePdf()
|
|
|
+ .ShowResults()
|
|
|
+ .Render(container =>
|
|
|
+ {
|
|
|
+ container
|
|
|
+ .Padding(25)
|
|
|
+ .DefaultTextStyle(x => x.FontSize(8))
|
|
|
+ .MultiColumn(multiColumn =>
|
|
|
+ {
|
|
|
+ multiColumn.Columns(3);
|
|
|
+ multiColumn.Spacing(25);
|
|
|
+ multiColumn.BalanceHeight();
|
|
|
+
|
|
|
+ multiColumn.Decoration().AlignCenter().LineVertical(2).LineColor(Colors.Grey.Medium);
|
|
|
+
|
|
|
+ multiColumn
|
|
|
+ .Content()
|
|
|
+ .Column(column =>
|
|
|
+ {
|
|
|
+ column.Spacing(10);
|
|
|
+
|
|
|
+ foreach (var blockId in Enumerable.Range(0, 100))
|
|
|
+ column.Item().Height(50).Background(Placeholders.BackgroundColor());
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -55,34 +95,40 @@ public class MultiColumnExamples
|
|
|
container
|
|
|
.Padding(25)
|
|
|
.DefaultTextStyle(x => x.FontSize(8))
|
|
|
- .MultiColumn(2, 25)
|
|
|
- .Border(1)
|
|
|
- .Table(table =>
|
|
|
+ .MultiColumn(multiColumn =>
|
|
|
{
|
|
|
- table.ColumnsDefinition(columns =>
|
|
|
- {
|
|
|
- columns.RelativeColumn(1);
|
|
|
- columns.RelativeColumn(2);
|
|
|
- columns.RelativeColumn(3);
|
|
|
- });
|
|
|
+ multiColumn.Spacing(10);
|
|
|
+
|
|
|
+ multiColumn
|
|
|
+ .Content()
|
|
|
+ .Border(1)
|
|
|
+ .Table(table =>
|
|
|
+ {
|
|
|
+ table.ColumnsDefinition(columns =>
|
|
|
+ {
|
|
|
+ columns.RelativeColumn(1);
|
|
|
+ columns.RelativeColumn(2);
|
|
|
+ columns.RelativeColumn(3);
|
|
|
+ });
|
|
|
|
|
|
- table.Header(header =>
|
|
|
- {
|
|
|
- header.Cell().Element(Style).Text("#").Bold();
|
|
|
- header.Cell().Element(Style).Text("Label").Bold();
|
|
|
- header.Cell().Element(Style).Text("Description").Bold();
|
|
|
+ table.Header(header =>
|
|
|
+ {
|
|
|
+ header.Cell().Element(Style).Text("#").Bold();
|
|
|
+ header.Cell().Element(Style).Text("Label").Bold();
|
|
|
+ header.Cell().Element(Style).Text("Description").Bold();
|
|
|
|
|
|
- IContainer Style(IContainer container) => container.Border(1).BorderColor(Colors.Grey.Medium).Background(Colors.Grey.Lighten2).Padding(2);
|
|
|
- });
|
|
|
+ IContainer Style(IContainer container) => container.Border(1).BorderColor(Colors.Grey.Medium).Background(Colors.Grey.Lighten2).Padding(2);
|
|
|
+ });
|
|
|
|
|
|
- foreach (var i in Enumerable.Range(1, 10_000))
|
|
|
- {
|
|
|
- table.Cell().Element(Style).ShowEntire().Text(i.ToString());
|
|
|
- table.Cell().Element(Style).ShowEntire().Text(Placeholders.Label());
|
|
|
- table.Cell().Element(Style).ShowEntire().Text(Placeholders.Sentence());
|
|
|
+ foreach (var i in Enumerable.Range(1, 10_000))
|
|
|
+ {
|
|
|
+ table.Cell().Element(Style).ShowEntire().Text(i.ToString());
|
|
|
+ table.Cell().Element(Style).ShowEntire().Text(Placeholders.Label());
|
|
|
+ table.Cell().Element(Style).ShowEntire().Text(Placeholders.Sentence());
|
|
|
|
|
|
- IContainer Style(IContainer container) => container.Border(1).BorderColor(Colors.Grey.Medium).Background(i % 2 == 0 ? Colors.White : Colors.Grey.Lighten4).Padding(2);
|
|
|
- }
|
|
|
+ IContainer Style(IContainer container) => container.Border(1).BorderColor(Colors.Grey.Medium).Background(i % 2 == 0 ? Colors.White : Colors.Grey.Lighten4).Padding(2);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -101,15 +147,23 @@ public class MultiColumnExamples
|
|
|
.Padding(25)
|
|
|
.DefaultTextStyle(x => x.FontSize(8))
|
|
|
.ShrinkVertical()
|
|
|
- .MultiColumn(4, 30)
|
|
|
- .Column(column =>
|
|
|
+ .MultiColumn(multiColumn =>
|
|
|
{
|
|
|
- column.Spacing(10);
|
|
|
+ multiColumn.Columns(4);
|
|
|
+ multiColumn.BalanceHeight(true);
|
|
|
+ multiColumn.Spacing(10);
|
|
|
+
|
|
|
+ multiColumn
|
|
|
+ .Content()
|
|
|
+ .Column(column =>
|
|
|
+ {
|
|
|
+ column.Spacing(10);
|
|
|
|
|
|
- foreach (var sectionId in Enumerable.Range(0, 20))
|
|
|
- {
|
|
|
- column.Item().EnsureSpace(20).Text(Placeholders.Paragraph());
|
|
|
- }
|
|
|
+ foreach (var sectionId in Enumerable.Range(0, 20))
|
|
|
+ {
|
|
|
+ column.Item().EnsureSpace(20).Text(Placeholders.Paragraph());
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|