We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AllowRowBreakAcrossPages for embedded PDFGrid within another PDFGrid

Hi, since I cannot set different padding settings for a PDFGrid, I tried to embed a PDFGrid into every cell of a parent PDFGrid to have various padding. This method works somehow but for long text the splitting of text seem broken. Here is the codes I used:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Grid;
using Syncfusion.Pdf.Graphics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            _createPDF("C:\\test.pdf");
        }

        private static void _createPDF(string filename)
        {
            var pdf = new PdfDocument();
            var page = pdf.Pages.Add();
            var table = new PdfGrid();
            table.AllowRowBreakAcrossPages = true;
            table.Style.CellPadding = new PdfPaddings(20f, 20f, 10f, 10f);
            table.Columns.Add(2);
            for (var i = 1; i <= 20; ++i)
            {
                var sb = new StringBuilder();
                for (var j = 1; j <= i*10; ++j)
                {
                    sb.Append("Line #");
                    sb.Append(j);
                    sb.Append("\n");
                }

                _addTestContent(table, sb.ToString());
            }

            table.Draw(page, new PointF(0f, 0f));
            using (var f = new FileStream(filename, FileMode.Create))
            {
                pdf.Save(f);
            }
        }

        private static PdfGrid _createTable(string value)
        {
            var table = new PdfGrid();
            table.AllowRowBreakAcrossPages = true;
            table.Style.CellPadding = new PdfPaddings(10f, 10f, 5f, 5f);
            table.Style.CellSpacing = 0f;
            table.Columns.Add();
            var row = table.Rows.Add();
            row.Cells[0].Value = value;
            row.Cells[0].Style.Borders.All = PdfPens.Transparent;
            return table;
        }

        private static PdfGridRow _addTestContent(PdfGrid table, string value)
        {
            var row = table.Rows.Add();
            row.Cells[0].Value = table.Rows.Count().ToString();
            row.Cells[1].Value = _createTable(value);
            return row;
        }
    }
}


2 Replies

AS Abirami Selvan Syncfusion Team July 17, 2015 02:31 PM UTC

Hi William,
Thank you for using Syncfusion product.
Currently ,We are working on “To apply the pagination for long text when embed child grid into parent grid”. We will provide you complete details regarding this on 20th July ,2015.
Regards,
Abirami.


AS Abirami Selvan Syncfusion Team July 20, 2015 12:58 PM UTC

 
Hi William,

We consider “Long text has been broken
when embed child grid into parent grid” is an issue and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards,
Abirami.


Loader.
Up arrow icon