5

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?

SomeBody
  • 7,515
  • 2
  • 17
  • 33
peter3
  • 1,074
  • 13
  • 22
  • You show no code, you provide no MDDDL file. The underline does not show me where the column ends, it just shows where the paragraph inside the column ends. An MVCE would help. Maybe I could see more with `table.Borders.Width = 0.25;`, but code to play with would be much better. – I liked the old Stack Overflow Oct 13 '15 at 12:34
  • You wrote "The forum at Migradoc is of no help either." You did not ask your question on the MigraDoc forum. Why do you give the forum the thumb-down? – I liked the old Stack Overflow Oct 15 '15 at 12:54
  • @ThomasH: I can't show code, company policy. Sorry. I don't even know what a MDDDL or MVCE is, I use neither. – peter3 Oct 19 '15 at 13:34
  • @PDFsharpTeam: I didn't mean to give the thumbs-down to your forum and have amended my question accordingly. Sorry about that – peter3 Oct 19 '15 at 13:37
  • MCVE: http://stackoverflow.com/help/mcve MDDDL: http://www.pdfsharp.net/wiki/MigraDocDDL.ashx MigraDoc SSCCE Template: http://www.pdfsharp.net/wiki/SSCCE.ashx Use the SSCCE template, add a table (2 rows, 2 cells) and check the padding - there should be no unwanted padding. Then add code from your project until the unwanted padding appears. At that point you probably know where the padding comes from (many problems are solved by the asker in the process of creating an SSCCE aka MCVE) - or you can create an MDDDL file for inspection. – I liked the old Stack Overflow Oct 19 '15 at 14:16

3 Answers3

6

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

Davros Spignot
  • 191
  • 2
  • 8
0

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?

  • I am certain that there is something in the code that makes the padding in the cell columns, that's why I'm asking for tips on what I should look for. Yes, the line is the bottom border of the header row – peter3 Oct 19 '15 at 13:35
  • There is something in **your** code. Paragraph styles are one candidate. Consider sharing a **minimal** MDDDL file if you are not allowed to show any code. – I liked the old Stack Overflow Oct 19 '15 at 14:21
  • Uhm, it should be apparent that I meant my code, since Thomas wrote that "there must be something in your code responsible for the extra padding" and I concurred. Also, if I'm asking for things to look for, do you really assume that I meant the MigraDoc code and not my own? Are you being willfully obtuse? – peter3 Oct 19 '15 at 21:51
-1

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

peter3
  • 1,074
  • 13
  • 22