Hi,
I want to make the Amount column in right alignment in pdf grid cell. I have given the PDFTextAlignment to right but its not working properly. Please find the sample code and attached result and do the needfull. Thanks in advance.
Note: Want to align the FinalFee to Right Align and rest of the columns in Center Align .
My example code:
PdfStringFormat stringFormat = new PdfStringFormat(PdfTextAlignment.Right);
for (int i = 0; i < dtResult.Rows.Count; i++)
{
row = grid.Rows.Add();
for (int k = 0; k < dtResult.Columns.Count; k++)
{
row.Cells[k].Value = dtResult.Rows[i][k].ToString();
if (k == 3)//Final Fee make it right alignment
row.Cells[k].Style.StringFormat = stringFormat;// new PdfStringFormat(PdfTextAlignment.Right, PdfVerticalAlignment.Middle);
else
row.Cells[k].Style.StringFormat = stringFormat; // new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);
row.Cells[k].Style.Font = new PdfFont(PdfFontFamily.Courier, 8f);
row.Cells[k].Style.Borders.All = new PdfPen(System.Drawing.Color.Transparent);
}
}