Compare commits

..

2 Commits

Author SHA1 Message Date
MarcinZiabek 27a808b389 2023.4.2 release 2023-05-09 02:38:17 +02:00
Marcin Ziąbek e23a7bd821 Table: fixed zindex rendering issue (#555) 2023-05-09 02:36:13 +02:00
8 changed files with 79 additions and 43 deletions
+52
View File
@@ -316,6 +316,58 @@ namespace QuestPDF.Examples
});
}
[Test]
public void Bug_RowSpanWorksIncorrectly()
{
// https://github.com/QuestPDF/QuestPDF/issues/552
RenderingTest
.Create()
.ProduceImages()
.PageSize(PageSizes.A5.Landscape())
.ShowResults()
.Render(container =>
{
container.Padding(20).Table(table =>
{
table.ColumnsDefinition(columns =>
{
columns.RelativeColumn(1);
columns.RelativeColumn(2);
columns.RelativeColumn(2);
columns.RelativeColumn(2);
});
foreach (var i in Enumerable.Range(6, 9))
{
table.Cell().Element(CellStyleMainTable).Text($"{i:00}:00");
foreach (var j in Enumerable.Range(1, 3))
table.Cell().Element(CellStyleMainTable).Text("");
}
static IContainer CellStyleMainTable(IContainer container)
{
return container
.Border(0.5f).BorderColor(Colors.Blue.Lighten4)
.Background(Colors.Blue.Lighten5)
.PaddingVertical(5);
}
table.Cell().Row(1).RowSpan(3).Column(2).Element(BlockAccepted).Text("3 rows");
table.Cell().Row(1).RowSpan(6).Column(3).Element(BlockAccepted).Text("6 rows");
table.Cell().Row(3).RowSpan(5).Column(4).Element(BlockAccepted).Text("5 rows");
static IContainer BlockAccepted(IContainer container)
{
return container
.Border(1.5f).BorderColor(Colors.Green.Lighten2)
.Background(Colors.Green.Lighten4);
}
});
});
}
[Test]
public void TableHeader()
{
+13 -9
View File
@@ -21,20 +21,24 @@ namespace QuestPDF.ReportSample
var model = DataSource.GetReport();
Report = new StandardReport(model);
}
[Test]
public void GenerateAndShowPdf()
{
//ImagePlaceholder.Solid = true;
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.pdf");
Report.GeneratePdf(path);
Process.Start("explorer.exe", path);
}
[Test]
public void GeneratePdfAndShow()
public void GenerateAndShowXps()
{
Report.GeneratePdfAndShow();
}
[Test]
public void GenerateXpsAndShow()
{
Report.GenerateXpsAndShow();
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"test_result.xps");
Report.GenerateXps(path);
Process.Start("explorer.exe", path);
}
}
}
+1 -1
View File
@@ -112,7 +112,7 @@ namespace QuestPDF.Elements.Table
UpdateColumnsWidth(availableSpace.Width);
var renderingCommands = PlanLayout(availableSpace);
foreach (var command in renderingCommands)
foreach (var command in renderingCommands.OrderBy(x => x.Cell.ZIndex))
{
if (command.Measurement.Type == SpacePlanType.FullRender)
command.Cell.IsRendered = true;
@@ -8,6 +8,8 @@ namespace QuestPDF.Elements.Table
public int Column { get; set; } = 0;
public int ColumnSpan { get; set; } = 1;
public int ZIndex { get; set; }
public bool IsRendered { get; set; }
}
}
@@ -16,9 +16,13 @@ namespace QuestPDF.Elements.Table
{
var cellsWindow = new List<TableCell>();
(int x, int y) currentLocation = (1, 1);
var zIndex = 0;
foreach (var cell in cells)
{
cell.ZIndex = zIndex;
zIndex++;
if (cellsWindow.Count > Math.Max(columnsCount, 16))
{
cellsWindow = cellsWindow
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using QuestPDF.Drawing;
using QuestPDF.Infrastructure;
@@ -29,13 +28,6 @@ namespace QuestPDF.Fluent
DocumentGenerator.GeneratePdf(stream, document);
}
public static void GeneratePdfAndShow(this IDocument document)
{
var filePath = Path.Combine(Path.GetTempPath(), $"QuestPDF Document.pdf");
document.GeneratePdf(filePath);
OpenFileUsingDefaultProgram(filePath);
}
#endregion
#region XPS
@@ -58,13 +50,6 @@ namespace QuestPDF.Fluent
DocumentGenerator.GenerateXps(stream, document);
}
public static void GenerateXpsAndShow(this IDocument document)
{
var filePath = Path.Combine(Path.GetTempPath(), $"QuestPDF Document.xps");
document.GenerateXps(filePath);
OpenFileUsingDefaultProgram(filePath);
}
#endregion
#region Images
@@ -92,22 +77,5 @@ namespace QuestPDF.Fluent
}
#endregion
#region Helpers
private static void OpenFileUsingDefaultProgram(string filePath)
{
var process = new Process
{
StartInfo = new ProcessStartInfo(filePath)
{
UseShellExecute = true
}
};
process.Start();
}
#endregion
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<Authors>MarcinZiabek</Authors>
<Company>CodeFlint</Company>
<PackageId>QuestPDF</PackageId>
<Version>2023.4.1</Version>
<Version>2023.4.2</Version>
<PackageDescription>QuestPDF is an open-source, modern and battle-tested library that can help you with generating PDF documents by offering friendly, discoverable and predictable C# fluent API. Easily generate PDF reports, invoices, exports, etc.</PackageDescription>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/Resources/ReleaseNotes.txt"))</PackageReleaseNotes>
<LangVersion>9</LangVersion>
@@ -4,3 +4,9 @@ This release does not contain any features or quality improvements.
Its purpose is to mark the QuestPDF shift towards the dual-licensing model.
Most users are not affected by this change.
Please visit the https://www.questpdf.com/pricing.html webpage for more information.
Version 2023.4.1:
Added IntelliSense-powered documentation for certain API methods.
Version 2023.4.2:
Fix: fixed the rendering order of table cells in certain scenarios