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.
Syncfusion Feedback

PdfGrid Header text position

Thread ID:

Created:

Updated:

Platform:

Replies:

92699 Feb 1,2010 09:55 AM UTC Feb 1,2010 10:57 AM UTC Windows Forms 2
loading
Tags: PDF
Matt Turnbull
Asked On February 1, 2010 09:55 AM UTC

What is the correct way to center align the text. The following code does not work.

PdfGridRow header = grid.Headers[0];

for (int i = 0; i < grid.Columns.Count; i++)
{
PdfGridCell cell = header.Cells[i];

Matt Turnbull
Replied On February 1, 2010 09:57 AM UTC

sorry message was lost

full code should be

PdfGridRow header = grid.Headers[0];

for (int i = 0; i < grid.Columns.Count; i++)
{
PdfGridCell cell = header.Cells[i];

if (i == 0)
{
}
else
{
cell.Style.StringFormat.Alignment = PdfTextAlignment.Center;
cell.Style.StringFormat.LineAlignment = PdfVerticalAlignment.Middle;
}
}

Divya G [Syncfusion]
Replied On February 1, 2010 10:57 AM UTC

Hi Matt,

Thank you for your interest in syncfusion products.

Kindly refer the below code snippet to align the text.
(C#)

PdfGridRow header = grd.Headers[0];
for (int i = 0; i < grd.Columns.Count; i++)
{
PdfGridCell cell = header.Cells[i];
if (i == 0)
{
}
else
{
PdfStringFormat stringFormat = new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);
cell.StringFormat = stringFormat;
}
}


Please let us know if you have any questions.
Regards,
Divya.G

CONFIRMATION

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.

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

;