Align nested grid to the bottom (Syncfusion.Pdf.WinForms.19.3.0.53)

How can I align grid nested in a cell to the bottom?

I know  new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Bottom) can be used for text, but how is it for non-text?

public void AlignNestedGrid()

        {

            using (PdfDocument pdfDocument = new PdfDocument())

            {

                //Create the page

                var section = pdfDocument.Sections.Add();

                var pdfPage = section.Pages.Add();

                section.PageSettings.SetMargins(25);

                pdfDocument.PageSettings.SetMargins(25);

                //Create the parent grid

                PdfGrid pGrid = new PdfGrid();

                FillGrid(pGrid, "pGrid", 5, 4);


                PdfGrid child1 = new PdfGrid();

                FillGrid(child1, "child1", 2, 2);


                pGrid.Rows[4].Height = 80;

                pGrid.Columns[3].Width = 100;

                pGrid.Rows[4].Cells[3].Value = child1;

                // QUESTION: how to align child1 grid to the bottom?

                pGrid.Rows[4].Cells[3].StringFormat = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Bottom);


                //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");

            }

        }




2 Replies 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team December 27, 2021 03:39 PM UTC

Hi umlprog, 
 
At present, we can support for formatting the text type by using PdfStringFormat class. Currently, we are checking the work around possibilities to achieve your requirement on our end and we will update the further details on December 29th 2021. 
 
Regards, 
Gowthamraj K 



GK Gowthamraj Kumar Syncfusion Team December 29, 2021 12:17 PM UTC

Hi umlprog, 

On our further analysis, we do not have direct support for formatting the non-text element (Nested grid) in the grid cell. As a work around we can achieve this requirement using PdfCellPadding. We have created the simple sample with this workaround solution. Please find the download link below, 
 
 
Kindly try the above sample in your end and let us know the result. 
 
Regards, 
Gowthamraj K 


Marked as answer
Loader.
Up arrow icon