PdfSharpCore icon indicating copy to clipboard operation
PdfSharpCore copied to clipboard

Not possible to set individual Table Cell padding

Open brendonupson opened this issue 2 years ago • 0 comments

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

  • Create a Table
  • Try to set the padding of one cell

brendonupson avatar Dec 13 '22 22:12 brendonupson