Search code examples
c#pdf-generationmigradoccellpadding

Removing table cell padding in Migradoc PDF


I'm trying to remove some unwanted padding in a Migradoc-generated PDF; but so far no luck. I went to the Migradoc forum, but couldn't find any issues that were the same as mine (and I didn't want to register on yet another site to ask a single question). This is how it looks: Unwanted padding around table cells

The padding I want to remove is the white space between the columns on each row, i.e. between "Artikel" and "Beskrivning". You can see from the underline that the "Artikel" column ends well before the "Beskrivning" column starts.

I've tried all the usual suspects as suggested elsewhere, like:

table.Borders.Width = 0;  
table.LeftPadding = 0; 
table.RightPadding = 0;

etc. I've also tried setting these values on each row and cell, but nothing seem to work. It doesn't seem like the width of the columns have any effect on the result either: if I make the cells narrower, they will wrap to a new row, but the padding remains the same.

Any suggestions how to proceed?


Solution

  • Turns out that if you set table.LeftIndent, it will actually propagate that value to every cell as well. Who would have thunk?

    Also begs the question how to left indent a table without having every cell left indented as well, but I am not sure I want to ask...