6

I want to set the minimum height of row. however it seems there is limit i am using below code [http://forum.pdfsharp.de/viewtopic.php?f=2&t=2812 ]

var spacerRow = t1.AddRow();
spacerRow.Height = "0.1mm";
var para2 = new Paragraph();
para2.Format.LineSpacingRule = LineSpacingRule.Exactly;
para2.Format.LineSpacing = "0.1mm";
para2.Format.SpaceBefore = 0;
para2.Format.SpaceAfter = 0;
spacerRow.Cells[0].Add(para2);

but the height is not reducing any further. the spacer row is between the borderd rows as show in attached picture.

enter image description here

Maqsood
  • 369
  • 4
  • 17
  • I don't think that is where the issue of spacing is coming from. You should be able to remove all the SpaceBefore info as these would default to 0 – Fuzzybear Dec 05 '16 at 13:32
  • @PDFsharpExpert the reason of adding the paragraph is that it was mentioned on the pdf forum that without adding paragraph tag we are not able to set the height. yes there is nothing between the rows except the spacerparagraph – Maqsood Dec 05 '16 at 13:37
  • @Fuzzybear the thing is i dont want to remove all the space. i want it to reduce. – Maqsood Dec 05 '16 at 13:39
  • Oh so spacerRow is just a row in the table, sorry completely missread, you will need to set the height on the table cell on that row. – Fuzzybear Dec 05 '16 at 13:43
  • @Fuzzybear i tried that also just to check the code i increase the height it works perfectly but it is not reducing the height after this. However i want to reduce it further. – Maqsood Dec 05 '16 at 13:47

1 Answers1

12

If you want to do it for all rows:

Table table = new Table();
table.Format.Alignment = ParagraphAlignment.Center;
table.Rows.HeightRule = RowHeightRule.Exactly;
table.Rows.Height = 5;

For a single row:

row = table.AddRow();
row.HeightRule = RowHeightRule.Exactly;
row.Height = 5;
homes
  • 265
  • 1
  • 3
  • 12