PdfRow Height set clips content of a nested grid

1.When we set row height inside PdfGrid, nested PdfGrid (child1) gets clipped. How can I make nested grid or row to autogrow?

2.Also I found strange behaviour that if we don't set row height, but simply read its Height property, content will not autogrow. (Uncomment Debug.WriteLine and comment line above it.)

`

        public void CreateGrid()

        {

            using (PdfDocument pdfDocument = new PdfDocument())

            {

                //Create the page

                PdfPage pdfPage = pdfDocument.Pages.Add();

                //Create the parent grid

                PdfGrid pGrid = new PdfGrid();

                pGrid.Columns.Add();

                pGrid.Rows.Add();

                pGrid.Columns[0].Width = 800;


                var parentGrid = new PdfGrid();

                parentGrid.Columns.Add();

                parentGrid.Rows.Add();

                pGrid.Rows[0].Cells[0].Value = parentGrid;

                parentGrid.Rows[0].Height = 20;

                //System.Diagnostics.Debug.WriteLine($"Row height: {parentGrid.Rows[0].Height}");

                PdfGrid child1 = new PdfGrid();


                parentGrid.Rows[0].Cells[0].Value = child1;

                FillGrid(child1, "child1", 5, 5);


                PdfGrid child2 = new PdfGrid();

                FillGrid(child2, "child2", 5, 7);

                parentGrid.Rows.Add();

                parentGrid.Rows[1].Cells[0].Value = child2;


                //Draw the parent PdfGrid

                pGrid.Draw(pdfPage, PointF.Empty, new PdfGridLayoutFormat { Break = PdfLayoutBreakType.FitPage, Layout = PdfLayoutType.Paginate });

                //Save the document

                pdfDocument.Save("NestedTable.pdf");

                //Close the document

                pdfDocument.Close(true);

                //This will open the PDF file so, the result will be seen in default PDF viewer

                System.Diagnostics.Process.Start("NestedTable.pdf");

            }

        }


        void FillGrid(PdfGrid grid, string name, int iMax, int jMax)

        {


            for (int j = 0; j < jMax; j++)

            {

                grid.Columns.Add();

                grid.Columns[j].Width = 50 + 5 * j;

            }


            for (int i = 0; i < iMax; i++)

            {

                grid.Rows.Add();

                for (int j = 0; j < jMax; j++)

                {

                    var cell = grid.Rows[i].Cells[j];

                    cell.Value = $"grid: {name}. i:{i},j:{j}";

                    System.Diagnostics.Debug.WriteLine($"Height: {cell.Height}, width:{cell.Width}");

                }

            }

        }`



Capture.PNG


8 Replies

GK Gowthamraj Kumar Syncfusion Team December 15, 2021 03:32 PM UTC

Hi umlprog, 
 
Thank you for contacting Syncfusion support. 
 
Currently, we are analyzing your requirement with provided details on our end and we will update the further details on December 17th 2021. 
 
Regards, 
Gowthamraj K 



UM umlprog December 15, 2021 09:35 PM UTC

We are using 19.3.0.53 NuGet version.

For now I'm forced to write

           var m_isRowHeightSetField = this.row.GetType().GetField("m_isRowHeightSet", BindingFlags.Instance |

                                                                                   BindingFlags.Public |

                                                                                   BindingFlags.NonPublic);

            m_isRowHeightSetField.SetValue(this.row, false);

when in code we determine that a PdfGrid will be set to a cell and from behaviour know that initially set Height will not autoincrease.



GK Gowthamraj Kumar Syncfusion Team December 16, 2021 12:45 PM UTC

Hi umlprog,  

As we said earlier, we are analyzing your requirement with provided details on our end and we will update the further details on December 17th 2021.  
  
Regards,  
Gowthamraj K 



GK Gowthamraj Kumar Syncfusion Team December 17, 2021 01:06 PM UTC

Hi umlprog, 
 
1.When we set row height inside PdfGrid, nested PdfGrid (child1) gets clipped. How can I make nested grid or row to autogrow? 
On our further analysis, if we set the row height in the PdfGridRow , the height will not be auto increase based on the nested grid content. The height will remain same for particular grid row for whole process. 
2.Also I found strange behaviour that if we don't set row height, but simply read its Height property, content will not autogrow. (Uncomment Debug.WriteLine and comment line above it.) 
This behavior occurs due to the height value is calculated before adding nested grid while getting grid row height in Debug.WriteLine. We have confirmed the issue “Cell clipping issue occurs when drawing a PDF grid with row height on nested grid” as a defect in our product. We will include the fix for this issue in our upcoming weekly NuGet release, which will be available on December 28th , 2021. 
  
Please use the below feedback link to track the status of the reported bug. 
 
Regards, 
Gowthamraj K 



UM umlprog December 23, 2021 06:42 PM UTC

So how can I make the row autoincrease? We don't know grid height in advance.



GK Gowthamraj Kumar Syncfusion Team December 27, 2021 12:49 PM UTC

Hi umlprog,  

If we did not set the grid row height, then it will be automatically auto increase the grid. During this behavior, we are facing an issue occurs due to the height value is calculated before adding nested grid while getting grid row height in Debug.WriteLine. We will include the fix for this issue “Cell clipping issue occurs when drawing a PDF grid with row height on nested grid” in our upcoming weekly NuGet release, which will be available on December 28th , 2021.  
   
Please use the below feedback link to track the status of the reported bug.  

Regards, 
Gowthamraj K 



GK Gowthamraj Kumar Syncfusion Team December 28, 2021 01:01 PM UTC

Hi umlprog, 

We have included the fix for the reported issueCell clipping issue occurs when drawing a PDF grid with row height on nested grid”  in our latest weekly NuGet release (v19.4.0.40). Please use the below link to download our latest weekly NuGet,     

  
Please let us know if you have any concerns on this 
 
Regards, 
Gowthamraj K 



UM umlprog December 30, 2021 11:40 AM UTC

Thanks for your update. We will try your fix soon.


Loader.
Up arrow icon