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

PDfGrid TextAlign of a whole column

Thread ID:





119958 Aug 18,2015 03:46 PM UTC Aug 21,2015 05:53 AM UTC ASP.NET MVC 3
Tags: PDF
Martin Bach
Asked On August 18, 2015 03:46 PM UTC

although described in your help (http://help.syncfusion.com/aspnetmvc; "PDF / Table / Grid / Formatting a grid"; ) this does not work:


You can specify the content format for the PdfGrid columns by using the Format property. Check String Formatting in DrawingText for more details"

I tried:

grid.Columns[3].Format = new PdfStringFormat(PdfTextAlignment.Right);

How can i set the alignment of a whole column in a pdfgrid?

Karthik Krishnaraj [Syncfusion]
Replied On August 19, 2015 09:56 AM UTC

Hi Martin,
Thank you for using Syncfusion products,
It is not possible to set alignment of whole column using PdfGrid, we can achieve this only by setting to each columns separately. However, this feature is available in PdfLightTable. Here we can set Default Style property for alignment of whole column. I have attached a simple sample for your reference below, please have a look through it and let us know if you have any other queries.
Code Snippet:

//Create Light Table

PdfLightTable lightTable = new PdfLightTable();

//Set Data Table

lightTable.DataSource = dataTable;

//Set default style for whole grid column
lightTable.Style.DefaultStyle.StringFormat = new PdfStringFormat(PdfTextAlignment.Center);
Sample Link:


Martin Bach
Replied On August 20, 2015 05:09 PM UTC

so how to align a text in a pdfgridcell to the right?

i tried

row.Cells[9].StringFormat = new PdfStringFormat(PdfTextAlignment.Right);

but that does not work either

Karthik Krishnaraj [Syncfusion]
Replied On August 21, 2015 05:53 AM UTC

Hi Martin,
I am afraid that I couldn’t able to reproduce the issue from our side, I have attached a simple sample for applying string format for PdfGridCell, can you please check through the below sample and let us know if you have any other queries.
Sample Link:


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