ststeiger / PdfSharpCore

Port of the PdfSharp library to .NET Core - largely removed GDI+ (only missing GetFontData - which can be replaced with freetype2)
Other
1.06k stars 235 forks source link

Not possible to set individual Table Cell padding #316

Open brendonupson opened 1 year ago

brendonupson commented 1 year ago

Expected Behavior

Cell padding should be adjustable on a cell by cell basis. In my case I have a small table embedded in a cell and I want the embedded table to occupy the entire cell area.

Actual Behavior

When a cell is rendered, its content uses cell.Column.LeftPadding and cell.Row.TopPadding as the offsets.

See: https://github.com/ststeiger/PdfSharpCore/blob/master/MigraDocCore.Rendering/MigraDoc.Rendering/TableRenderer.cs

private void RenderContent(Cell cell, Rectangle innerRect)

Lines 163, 169, 174, 175

Suggested enhancement: Introduce new properties to Cell https://github.com/ststeiger/PdfSharpCore/blob/master/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Cell.cs

LeftPadding
RightPadding
TopPadding
BottomPadding

which are added to their Column and Row values. Setting a negative cell.LeftPadding could then be used to remove the overall cell left padding.

Steps to Reproduce the Behavior