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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PdfLightTable styling cell

Thread ID:





100823 Sep 8,2011 09:27 AM UTC Sep 16,2011 12:25 PM UTC ASP.NET Web Forms (Classic) 5
Tags: PDF
Sanjay Bhagia
Asked On September 8, 2011 09:27 AM UTC


I've been struggling for quite some time to style specific cell but with no luck.

I want to style first column of the table (like make content bold)
and secondly, i want to style rows not cell (to have borders only at the bottom not on left or right). Is there any way i can control this?

I have also tried using PdfGrid but i guess i faced some other restrictions there (like styling headers etc).


Geetha M [Syncfusion]
Replied On September 9, 2011 04:22 AM UTC

Hi Sanjay,

Thank you for your interest in Syncfusion products.

It is possible to achieve your requirement using PdfGrid. Kindly refer the sample placed in the link below.


Also, you can style the headers using the PdfGridRowStyle or PdfGridCellStyle classes. Please refer to the code snippet below.

grid.Headers[0].Style.TextPen = PdfPens.Red;
grid.Headers[0].Cells[0].Style.BackgroundBrush = PdfBrushes.LightBlue;

Please let me know if you have any questions.


Sanjay Bhagia
Replied On September 9, 2011 08:17 AM UTC

thanks for the response. can i render images in cells if im using pdfgrid?

Geetha M [Syncfusion]
Replied On September 12, 2011 03:38 AM UTC

Hi Sanjay,

Yes. It is possible to render image in cells using the following code snippet:

grid.Rows[0].Cells[0].Style.BackgroundImage = PdfImage.FromFile("../../Data/icon.png");

Please refer to the following documentation link:
Background Image Position for PDF Grid Cell

Please try this and let me know if you have any questions.


Sanjay Bhagia
Replied On September 15, 2011 10:49 AM UTC

Thanks Geetha,

I'm finding my way around this product quite good now. !!

Could you please send me any sample where i can merge header cells in PdfLightTable and PdfGrid please?
I want value in only first cell of the table but span it across.


Geetha M [Syncfusion]
Replied On September 16, 2011 12:25 PM UTC

Hi Sanjay,

Thank you for the details.

In PdfLightTable, you can merge cells using the BeginRowLayout event. Following is the code snippet:

table.BeginRowLayout += new BeginRowLayoutEventHandler(table_StartRowLayout);

void table_StartRowLayout(object sender, BeginRowLayoutEventArgs args)
int rowIndex = args.RowIndex;

if (rowIndex == -1) // -1 for header row
int[] spanMap = new int[count];

//Set span for first and thrid cells in a row of 5 cells.
spanMap[0] = 2;
spanMap[2] = 3;

args.ColumnSpanMap = spanMap;

In PdfGrid, it can be achieved using the following code:
grid.Headers[0].Cells.ColumnSpan = 2;

Please try this and let me know if you have any questions.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon