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.

PdfLightTable styling cell

Thread ID:





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


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 12:22 AM

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 04:17 AM

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

Geetha M [Syncfusion]
Replied On September 11, 2011 11:38 PM

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 06:49 AM

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 08:25 AM

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.

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.