peter3
peter3

Reputation: 1074

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?

Upvotes: 5

Views: 5120

Answers (3)

Davros Spignot
Davros Spignot

Reputation: 191

I arrived on this answer trying to get rid of the default left and right padding on a migradoc table cell. For me the answer was this table property

grayTable.LeftPadding = 0;
grayTable.RightPadding = 0;

This removed the left and right padding from all cells. This concept was well discussed on other forums but not answered

I hope this helps someone.

default left and right cell padding migradoc

Upvotes: 6

peter3
peter3

Reputation: 1074

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...

Upvotes: -1

Here's a table I created with MigraDoc - without adding or removing any padding:
MigraDoc Table

You can see from the underline where the column ends - at least for the left column where the text wraps to the second line. The text in the other columns is too short.

There must be something in your code responsible for the extra padding. To answer your question "Any suggestions how to proceed?": Show us that code if you seriously want help.

Maybe you add paragraphs with left or right indent to your table. I do not even know what the underline is that I see on your screen shot. Is it the bottom border of the paragraph?

Upvotes: 0

Related Questions