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 Cell text alignment

Thread ID:





71627 Feb 7,2008 06:18 PM UTC Feb 11,2008 06:07 AM UTC ASP.NET Web Forms (Classic) 1
Tags: PDF
Asked On February 7, 2008 06:18 PM UTC

I'm trying to put a header on my PDF pages that has the title on the left and the current date on the right. I can't seem to figure it out. I tried using the PdfTextElement but I can't seem to draw that to the PdfPageTemplateElement and give it a PdfStringFormat with a RightAlignment.

So I next tried to do a PdfLightTable by building up a DataTable for those two items. But I can't figure out how to do an alignment within a table cell.

Also, with your older versions I think I remember being able to build up a table programmatically which gave me much more control over each cell because I could give each one a CellStyle. Is there a way to do tables this way in version 6.1?

Yavanaarasi G [Syncfusion]
Replied On February 11, 2008 06:07 AM UTC

Hi Jeff,

Sorry for the delay in responding.

1.How to do an alignment within a table cell?

You can use the following code snippet for alignment within a table cell:

PdfStringFormat sf2 = new PdfStringFormat(PdfTextAlignment.Right);
PdfStringFormat sf1 = new PdfStringFormat(PdfTextAlignment.Left);

2.I could give each one a CellStyle. Is there a way to do tables this way in version 6.1?

Yes.It is possible in our new PDF. You can Use below code snippet for setting cellstyle:

PdfCellStyle altStyle = new PdfCellStyle();
altStyle.Font =font;
altStyle.BackgroundBrush = brush;
altStyle.BorderPen = borderPen;
altStyle.StringFormat = sf2;

Please refer the sample in the below link which illustrates the above:


Here is the documentation link for table features and formatting the table in new PDF:


Please try running the above sample and let me know if this helps.



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

This page will automatically be redirected to the 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