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.

PdfGrid Header text position

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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

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 05:57 AM

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.

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.

;