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

PDfGrid TextAlign of a whole column

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?

3 Replies

KK Karthik Krishnaraj Syncfusion Team 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:


MB Martin Bach 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

KK Karthik Krishnaraj Syncfusion Team 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:

Live Chat Icon For mobile
Up arrow icon