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
close icon

PdfGrid Column Span

I can't seem to get column spanning to work correctly with the PdfGrid. It seems that setting the column span simply allows the text to "bleed" into other columns. However, if your cells contain borders, then the borders of the spanned columns are rendered over the top of the text. Also if your grid is using a background brush, then the background is rendered on top the text in the spanned cells as well. I was expecting that the second cell would just be one large cell that spanned all 3 columns.

Here's the code:

PdfGrid grid = new PdfGrid();
grid.Style.BackgroundBrush = Brushes.Light; // Commented out in the first exampmle.
grid.Columns.Add(4);

PdfGridRow row = grid.Rows.Add();
row.Cells[0].Value = "Job/Extra:";
row.Cells[1].ColumnSpan = 3;
row.Cells[1].Value = report.Job.ToString();

grid.Draw(Graphics, Bounds.Location, Bounds.Width);

Any help is appreciated.

Thanks,
Jason



ColSpan_b582272a.zip

5 Replies

TE Thiruvenkadam E Syncfusion Team September 15, 2009 12:37 PM UTC

Hi Jason,

Thank you for your interest in Syncfusion products.

PdfGrid Column Spanning is not working properly

I am afraid that I was not able to reproduce the reported issue in our side . Please check the working sample in the link below location ,

http://files.syncfusion.com/support/Pdf.Windows/F89946/PDFGrid.zip

Please have a look at the above sample and if still the issue exists,

Could you please try to reproducing it in the above sample or send us few documents so that we could sort out the cause of the issue and provide you a solution?

Please let us know if you need any further information.

Regards,
Thiru


JS Jason Smith September 15, 2009 03:44 PM UTC

Yes, I was able to recreate the error. It appears that if you give the grid a width then it renders incorrectly. Change the following line:

grid.Draw(page.Graphics, new PointF(10,10));

to:

grid.Draw(page.Graphics, new PointF(10,10), 400));

You will then see that it renders all the cells and covers up the text that should be spanning multiple columns.

Our usage of this control requires being able to specify a width and so this control is useless to us if we cannot specify a width. Any help would be appreciated.


TE Thiruvenkadam E Syncfusion Team September 16, 2009 12:24 PM UTC

Hi Jason,

Thanks for the update.

I was able to see the reported issue . Please create a Drect-Trac incident (mention the forum link in the subject line) so that we will fix this issue and we update you with the fix.

Please let me know if you need further assistance any questions.

Regards,
Thiru


TT Thorsten Thelen June 30, 2010 12:15 PM UTC

Hi Syncfusion-Members,
we have a problem with ColumnSpan in the headers.

The ColumnSpan and the BackgroundBrush doesn't work in headers. In a normal row works it fine. (look at the attachment)

(We are use the version 7.303.0.20)

What can I do?

Many thanks,
Thorsten


Example code:

//Create a new pdf document
PdfDocument doc = new PdfDocument();

//Adds a pdf page.
PdfPage page = doc.Pages.Add();

//Create a new pdf grid.
PdfGrid grid = new PdfGrid();
grid.Style.BackgroundBrush =PdfBrushes.LightBlue;
grid.Columns.Add(5);

PdfGridRow head = grid.Headers.Add(1)[0];
head.Cells[0].Value = "Job/Extra:";
head.Cells[1].ColumnSpan = 3;
head.Cells[1].Value = "Cell2 (00.06.251): Blue Mountail Hospital";
head.Cells[4].Value = "Hello";

PdfGridRow row = grid.Rows.Add();
row = grid.Rows.Add();
row.Cells[0].Value = "Job/Extra1:";
row.Cells[1].Value = "Job/Extra2:";
row.Cells[2].Value = "Job/Extra3:";
row.Cells[3].Value = "Job/Extra4:";
row.Cells[4].Value = "Job/Extra5:";

//Draws a grid
grid.Draw(page.Graphics, new PointF(10, 10));

//Saves the document
doc.Save("Sample.pdf");

doc.Close(true);



header_9bc7e3c6.zip


PJ Pravin Joshua D Syncfusion Team July 2, 2010 04:11 AM UTC

Hi Thorsten,

Thank you for using Essential PDF.

This is a known issue, which has been fixed recently.Could you please report these issues through Direct Trac Developer Support Systemhttps://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents so that we could provide you a patch containing the fix for the same.

Please let us know if you have any questions.

Regards,
Pravin.

Loader.
Live Chat Icon For mobile
Up arrow icon