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

merging pdf grids or their grid rows

I have following scenario

PdfGrid parentGrid = new PdfGrid();
//populate parentGrid so it contains  1 grid row

PdfGrid child1Grid= new PdfGrid();
//populate child1Grid. say it has 10 pdfgridrow


PdfGrid child2Grid= new PdfGrid();
//populate child2Grid so it has 30 pdfgridrow

Now I want to merger cgild1Grid and child2Grid into parentGrid so at end when i do

parentGrid.Dar and save i would have 41 grid rows








10 Replies

JB jb April 3, 2015 02:07 AM UTC

All grids in my example below have 22 cells and not all cells are filled in all grids


KC Karthikeyan Chandrasekar Syncfusion Team April 3, 2015 07:28 AM UTC

Hi Jb,
Thank you for your interest in Syncfuions Products.

We do have support for nested PdfGrid in Essential PDF, please find the below code snippet.


PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

// Set the value as another PdfGrid in a cell.
parentGrid.Rows[0].Cells[1].Value = childPdfGrid;


If you want to print the PdfGrid one after another please refer the below link for more reference.
http://www.syncfusion.com/kb/2690/how-to-calculate-pdfgrid-table-height

Please let us know if you need any further assistance in this.

Regards,
Karthikeyan.C



JB jb replied to Karthikeyan Chandrasekar April 22, 2015 08:21 PM UTC

Hi Jb,
Thank you for your interest in Syncfuions Products.

We do have support for nested PdfGrid in Essential PDF, please find the below code snippet.


PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

// Set the value as another PdfGrid in a cell.
parentGrid.Rows[0].Cells[1].Value = childPdfGrid;


If you want to print the PdfGrid one after another please refer the below link for more reference.
http://www.syncfusion.com/kb/2690/how-to-calculate-pdfgrid-table-height

Please let us know if you need any further assistance in this.

Regards,
Karthikeyan.C


If i do the following using your example as a sample

PdfGrid parentPdfGrid = new PdfGrid();
PdfGridRow parentRow = parentPdfGrid.Rows.Add();

PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

parentRow.Cells[0].Value = childPdfGrid;
results in ` Can't draw one or more inner grids, no enough space available for it.`

Basically in the cell i want to show 2 rows. Row 0 spans 4 columns. Row 1. 4 columns and each column has a value

Pasting HTML equivalent of what I want in the cell below
<table class="tg">
  <tr>
    <th class="tg-031e" colspan="3">Main</th>
  </tr>
  <tr>
    <td class="tg-031e">sub1</td>
    <td class="tg-031e">sub2</td>
    <td class="tg-031e">sub3</td>
  </tr>
</table>



JB jb replied to jb April 22, 2015 08:23 PM UTC

Hi Jb,
Thank you for your interest in Syncfuions Products.

We do have support for nested PdfGrid in Essential PDF, please find the below code snippet.


PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

// Set the value as another PdfGrid in a cell.
parentGrid.Rows[0].Cells[1].Value = childPdfGrid;


If you want to print the PdfGrid one after another please refer the below link for more reference.
http://www.syncfusion.com/kb/2690/how-to-calculate-pdfgrid-table-height

Please let us know if you need any further assistance in this.

Regards,
Karthikeyan.C


If i do the following using your example as a sample

PdfGrid parentPdfGrid = new PdfGrid();
PdfGridRow parentRow = parentPdfGrid.Rows.Add();

PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

parentRow.Cells[0].Value = childPdfGrid;
results in ` Can't draw one or more inner grids, no enough space available for it.`

Basically in the cell i want to show 2 rows. Row 0 spans 4 columns. Row 1. 4 columns and each column has a value

Pasting HTML equivalent of what I want in the cell below
<table class="tg">
  <tr>
    <th class="tg-031e" colspan="3">Main</th>
  </tr>
  <tr>
    <td class="tg-031e">sub1</td>
    <td class="tg-031e">sub2</td>
    <td class="tg-031e">sub3</td>
  </tr>
</table>


This pdfgrid has many columns, the html table sample is what i want inside a gridrow cell.


JB jb replied to jb April 22, 2015 08:26 PM UTC

Hi Jb,
Thank you for your interest in Syncfuions Products.

We do have support for nested PdfGrid in Essential PDF, please find the below code snippet.


PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

// Set the value as another PdfGrid in a cell.
parentGrid.Rows[0].Cells[1].Value = childPdfGrid;


If you want to print the PdfGrid one after another please refer the below link for more reference.
http://www.syncfusion.com/kb/2690/how-to-calculate-pdfgrid-table-height

Please let us know if you need any further assistance in this.

Regards,
Karthikeyan.C


If i do the following using your example as a sample

PdfGrid parentPdfGrid = new PdfGrid();
PdfGridRow parentRow = parentPdfGrid.Rows.Add();

PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

parentRow.Cells[0].Value = childPdfGrid;
results in ` Can't draw one or more inner grids, no enough space available for it.`

Basically in the cell i want to show 2 rows. Row 0 spans 4 columns. Row 1. 4 columns and each column has a value

Pasting HTML equivalent of what I want in the cell below
<table class="tg">
  <tr>
    <th class="tg-031e" colspan="3">Main</th>
  </tr>
  <tr>
    <td class="tg-031e">sub1</td>
    <td class="tg-031e">sub2</td>
    <td class="tg-031e">sub3</td>
  </tr>
</table>


This pdfgrid has many columns, the html table sample is what i want inside a gridrow cell.

sample code snippet

childPdfGrid.Columns.Add(3);
PdfGridRow row = childPdfGrid.Rows.Add();
row.Cells[0].ColumnSpan = 3;


row.Cells[0].Value = "Hello world";
row = childPdfGrid.Rows.Add();

childPdfGrid.Columns[0].Format.LineAlignment = PdfVerticalAlignment.Middle;


row.Cells[0].Value = "Sub1";
row.Cells[1].Value = "Sub2";
row.Cells[2].Value = "sub3";

parentGridRow.Cells[0].Value = childPdfGrid


KC Karthikeyan Chandrasekar Syncfusion Team April 23, 2015 05:28 AM UTC

Hi JB,
Thank you for your update.

We can achieve your requirement by using Column Span, I have attached a simple sample similar to your requirement. Could you please refer this and let us know is it helpful.
http://www.syncfusion.com/downloads/support/forum/118719/PdfGridSample698096172.zip

Please let us know if you need any further assistance.
Regards,
Karthikeyan.C


JB jb replied to Karthikeyan Chandrasekar April 23, 2015 08:13 PM UTC

Hi JB,
Thank you for your update.

We can achieve your requirement by using Column Span, I have attached a simple sample similar to your requirement. Could you please refer this and let us know is it helpful.
http://www.syncfusion.com/downloads/support/forum/118719/PdfGridSample698096172.zip

Please let us know if you need any further assistance.
Regards,
Karthikeyan.C

The solution you provided did not work

Here is a diagram
[IMG]http://i57.tinypic.com/4jvp5h.png[/IMG]

I am trying to do R1C1..R1C3

If i add a grid row then i get a border across the row on any columns whose columnspan is > 1


AS Abirami Selvan Syncfusion Team April 24, 2015 05:39 PM UTC

Hi Jb,
We have created the sample for your requirement. We have tried the sample by applying span. To apply the span, we are combining the rows and columns. So when we create the table as you mentioned structure , we get the columns like R0C0,R0C1 and R0C4.
We have attached the sample for your reference in the below link:
http://www.syncfusion.com/downloads/support/forum/118719/PdfGridSample2030664930.zip
Please try this and let us know if you need any further assistance.

Thanks,
Abirami.


JD Júlio Daniel Ferreira Papel replied to jb March 27, 2018 06:40 PM UTC

Hi Jb,
Thank you for your interest in Syncfuions Products.

We do have support for nested PdfGrid in Essential PDF, please find the below code snippet.


PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

// Set the value as another PdfGrid in a cell.
parentGrid.Rows[0].Cells[1].Value = childPdfGrid;


If you want to print the PdfGrid one after another please refer the below link for more reference.
http://www.syncfusion.com/kb/2690/how-to-calculate-pdfgrid-table-height

Please let us know if you need any further assistance in this.

Regards,
Karthikeyan.C


If i do the following using your example as a sample

PdfGrid parentPdfGrid = new PdfGrid();
PdfGridRow parentRow = parentPdfGrid.Rows.Add();

PdfGrid childPdfGrid = new PdfGrid();
childPdfGrid.Columns.Add(5);
for (int i = 0; i < 5; i++)
{
PdfGridRow row = childPdfGrid.Rows.Add();
for (int j = 0; j < 5; j++)
{
row.Cells[j].Value = String.Format("Cell [{0} {1}]", j, i);
}
}

parentRow.Cells[0].Value = childPdfGrid;
results in ` Can't draw one or more inner grids, no enough space available for it.`

Basically in the cell i want to show 2 rows. Row 0 spans 4 columns. Row 1. 4 columns and each column has a value

Pasting HTML equivalent of what I want in the cell below
<table class="tg">
  <tr>
    <th class="tg-031e" colspan="3">Main</th>
  </tr>
  <tr>
    <td class="tg-031e">sub1</td>
    <td class="tg-031e">sub2</td>
    <td class="tg-031e">sub3</td>
  </tr>
</table>


This pdfgrid has many columns, the html table sample is what i want inside a gridrow cell.

This needs to be updated!

Cheers.


SL Sowmiya Loganathan Syncfusion Team March 28, 2018 12:22 PM UTC

Hi Jb, 

We have earlier updated the sample for your requirement. Kindly check whether the previously updated sample meets your requirement. If not kindly share us the details regarding your requirement. It will helpful for us to provide the better solution on this. 

Please let us know if you need any further assistance. 

Regards, 
Sowmiya L 


Loader.
Live Chat Icon For mobile
Up arrow icon