Migradoc Table Row adding unknown Margin or Padding

229 Views Asked by At

I have a table in Migradoc that is adding some extra padding to each of the rows. Below is what I have for the row code

MigraDoc.DocumentObjectModel.Tables.Row PartRow = ItemTable.AddRow();                   
PartRow.Borders.Width = 1;

//PartRow.HeightRule = MigraDoc.DocumentObjectModel.Tables.RowHeightRule.Auto;
//PartRow.Height = "0.5in";

var Qty = PartRow.Cells[0].AddParagraph("1");
Qty.Format.Shading.Color = Colors.AliceBlue;
PartRow.Cells[1].AddParagraph(Part.Description);
PartRow.Cells[2].AddParagraph(Math.Round(Part.Width,3).ToString());
PartRow.Cells[3].AddParagraph(Math.Round(Part.Length,3).ToString());

if I try to force the row height using the 2 lines that are commented out, the data will then be outside the actual row by about 1 inch. Which seems to be a constant setting somewhere.

Here's what the output looks like before I try to constrain the height.

enter image description here

Any ideas? Thank you in advance.

EDIT I found earlier in my code that I added this line, because my table was overlapping my page header

ItemTable.Format.SpaceBefore = "1in";

When I remove that line, the problem goes away, but now the table is overlapping my page header and footer again

1

There are 1 best solutions below

0
I liked the old Stack Overflow On

The format you set for the table applies to all cells in the table.

To protect page contents from overlapping with headers and footers, you must set top margin and bottom margin of the pages to values that are large enough to fit the contents of header and footer in it.