Minimum height of Row [Migradoc]
Asked Answered
S

1

7

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

Siana answered 5/12, 2016 at 13:26 Comment(5)
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 0Fernandefernandel
@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 spacerparagraphSiana
@Fernandefernandel the thing is i dont want to remove all the space. i want it to reduce.Siana
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.Fernandefernandel
@Fernandefernandel 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.Siana
T
13

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;
Tila answered 12/4, 2017 at 18:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.