QuestPDF 格栅布局
Grid
元素根据内部多个 Row
元素创建整个布局。
- 空间被划分为多个列(默认为 12 列)。
- 每个项目可以占用多列。
- 如果一行中没有足够的空间容纳项目,它会被推到下一行。
- 如果空间大于所需,项目可以居左、居中或居右对齐。
- 在元素之间插入空隙是可能的。
.Grid(grid =>
{
grid.VerticalSpacing(15);
grid.HorizontalSpacing(15);
grid.AlignCenter();
grid.Columns(10); // 12 by default
grid.Item(6).Background(Colors.Blue.Lighten1).Height(50);
grid.Item(4).Background(Colors.Blue.Lighten3).Height(50);
grid.Item(2).Background(Colors.Teal.Lighten1).Height(70);
grid.Item(3).Background(Colors.Teal.Lighten2).Height(70);
grid.Item(5).Background(Colors.Teal.Lighten3).Height(70);
grid.Item(2).Background(Colors.Green.Lighten1).Height(50);
grid.Item(2).Background(Colors.Green.Lighten2).Height(50);
grid.Item(2).Background(Colors.Green.Lighten3).Height(50);
});