Spacing between rows

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v11)  /  Re: Spacing between rows

DynamicPDF CoreSuite for .NET (v11) Forum

 Jul 17 2023 4:26 PM
Hi,
We have a requirement where we want to reduce or increase the space between 2 rows in a table. Can you please help me out ?
 Jul 18 2023 11:23 AM
Posted by a ceTe Software moderator
Hi,

You can use CellPadding (Top and Bottom) to achieve that. Please refer to the documentation on cell padding here.

Here is a code sample:

            Document document = new Document();
            Table2 table = new Table2(0, 40, 600, 690);
          
            Column2 column1 = table.Columns.Add(100);
            Column2 column2 = table.Columns.Add(100);
            Column2 column3 = table.Columns.Add(100);
            Column2 column4 = table.Columns.Add(100);


            for (int j = 0; j < 50; j++)
            {
                Row2 row = table.Rows.Add(6);
                for (int i = 1; i < 5; i++)
                {
                    Cell2 cell1 = row.Cells.Add("Description");
                    cell1.Border.Width = 0.5f;
                    Cell2 cell2 = row.Cells.Add("Value");
                    cell2.Border.Width = 0.5f;
                    Cell2 cell3 = row.Cells.Add("12234");
                    cell3.Border.Width = 0.5f;
                    Cell2 cell4 = row.Cells.Add("1212222");
                    cell4.Border.Width = 0.5f;
                }
            }

            table.Rows[1].CellDefault.Padding.Bottom = 10;
            table.Rows[2].CellDefault.Padding.Top = 10;

            do
            {
                Page page = new Page();
                document.Pages.Add(page);
                page.Elements.Add(table);
                table = table.GetOverflowRows();

            } while (table != null);

            string outputPdf = @"C:\Temp\My12-Document.pdf";
            document.Draw(outputPdf);

Thanks,
ceTe Software Support Team
 Jul 18 2023 11:46 AM
It worked. Thank you so much for your help.

All times are US Eastern Standard time. The time now is 6:46 PM.