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.
Unfortunately, activation email could not send to your email. Please try again.

Nested Tables Support

Thread ID:

Created:

Updated:

Platform:

Replies:

82540 Jun 15,2009 09:44 AM Jul 10,2009 06:42 AM Windows Forms 5
loading
Tags: PDF
Steve Platz
Asked On June 15, 2009 09:44 AM

Is it possible to use nested tables with Syncfusion.Pdf? I have looked through the documentation and could not find anything. Additionally, I tried some things on my own, but when the table was rendered, the cell I was expecting a nested table to be in instead had "Syncfusion.Pdf.Tables.PdfLightTable" in it.

Simplified, here is the code I used:

PdfLightTable outerTable = new PdfLightTable();
outerTable.DataSourceType = PdfLightTableDataSourceType.TableDirect;

outerTable.Columns.Add(new PdfColumn("Column 1"));
outerTable.Columns.Add(new PdfColumn("Column 2"));

PdfLightTable innerTable = new PdfLightTable();
innerTable.DataSourceType = PdfLightTableDataSourceType.TableDirect;

innerTable.Columns.Add(new PdfColumn("Column 1"));
innerTable.Columns.Add(new PdfColumn("Column 2"));

innerTable.Rows.Add(new object[] { "Cell 1.1", "Cell 1.2" });

outerTable.Rows.Add(new object[] { "Cell 1", innerTable });

Sri Subhashini M [Syncfusion]
Replied On July 6, 2009 07:01 AM

Hi Steve,

Thank you for your interest in Essential PDF.

Nested Table

We can draw the table inside to another table by subscribing BeginCellLayout event handler.

Kindly refer the below code snippet to render the nested table,

// Event handler
table.BeginCellLayout +=new BeginCellLayoutEventHandler(table_BeginCellLayout);


void table_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)
{
if (args.CellIndex == 2 && args.RowIndex == 1)
{
DataTable dt = new DataTable();
dt.Columns.Add("Column 1");
dt.Columns.Add("Column 2");

dt.Rows.Add(new string[] { "Cell 1.1", "Cell 1.2" });
dt.Rows.Add(new string[] { "Cell 2.1", "Cell 2.2" });

PdfLightTable t1 = new PdfLightTable();
t1.DataSourceType = PdfLightTableDataSourceType.External;
t1.DataSource = dt;

t1.Draw(args.Graphics, args.Bounds.Location,args.Bounds.Width);
}
}

Please do find the sample from the below specified location and let me know if this helps,

http://files.syncfusion.com/samples/pdf.windows/PDF_F82540.zip

Regards,
Suba

Steve Platz
Replied On July 8, 2009 10:12 AM

That worked great for inserting a table in that cell, but now I'm running into the problem of the cell not growing in height to fit the contents of the nested table. I looked at the example you attached and it seemed the case was the same there as well. Is this possible?

Steve Platz
Replied On July 8, 2009 10:13 AM

I also meant to add that the nested table has its contents spill over into the adjacent cells, causing things to render incorrectly.

Steve Platz
Replied On July 8, 2009 10:30 AM

Better yet, is there a way to do row spans at all? I've found column spans in the documentation, but no mention of row span.

Sri Subhashini M [Syncfusion]
Replied On July 10, 2009 06:42 AM

Hi Steve,

Sorry for the delay in getting back with you.

Nested Table and RowSpan feature

We can draw the nested table and set the row span easily by using PdfGrid method and the Pdfgrid feature is available with our latest Essential Studio 2009 Volume.3 RC. This is available for download from the below location.

http://www.syncfusion.com/support/forums/general/86322/essential-studio-2009-vol3-rc-v73018-available-for-download

Could you please do find the sample which demonstrates the above mentioned feature and let me know if this helps?
http://files.syncfusion.com/samples/PDF.Windows/F82540.zip

Regards,
Suba

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.

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.

;