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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AllowRowBreakAcrossPages for embedded PDFGrid within another PDFGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

119632 Jul 16,2015 10:16 AM UTC Jul 20,2015 12:58 PM UTC ASP.NET MVC 2
loading
Tags: PDF
William Wong
Asked On July 16, 2015 10:16 AM UTC

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;
        }
    }
}


Abirami Selvan [Syncfusion]
Replied On 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.

Abirami Selvan [Syncfusion]
Replied On 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.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;