Skip to content

Commit bd759af

Browse files
committed
Support table cell background in DOCX renderer; add more samples
1 parent a1abcee commit bd759af

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

src/WIP/DocSharp.Renderer/DocxRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static DocxRenderer()
3131
/// </summary>
3232
public QuestPDF.Infrastructure.DocumentMetadata? PdfMetadata { get; set; }
3333

34-
private QuestPdfPageSet? currentPageSet; // Current section
34+
// private QuestPdfPageSet? currentPageSet; // Current section
3535
private Stack<QuestPdfContainer> currentContainer = new(); // Container can be the main document body, header, footer, table cell, ...
3636
private Stack<IQuestPdfRunContainer> currentRunContainer = new(); // Spans can only be added to a paragraph or hyperlink
3737
private Stack<QuestPdfParagraph> currentParagraph = new(); // Hyperlinks can only be added to a paragraph

src/WIP/DocSharp.Renderer/Model/QuestPdfModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ internal void AddTableToColumn(IContainer item, QuestPdfTable table)
342342
uint columnNumber = 1;
343343
foreach (var tc in row.Cells)
344344
{
345-
var cell = t.Cell().Row(rowNumber).Column(columnNumber).RowSpan(tc.RowSpan).ColumnSpan(tc.ColumnSpan);
345+
var cell = t.Cell().Row(rowNumber).Column(columnNumber).RowSpan(tc.RowSpan).ColumnSpan(tc.ColumnSpan)
346+
.Background(QuestPDF.Infrastructure.Color.FromHex(tc.BackgroundColor ?? Colors.Transparent));
346347

347348
cell.Column(column =>
348349
{

test-files/Renderer/Lists.docx

15.6 KB
Binary file not shown.

test-files/Renderer/Tables.docx

18.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)