TextAlignment in header does not work with header.Graphics.DrawText?

Hello Ma'am/Sir:

I have a datatable that would contain about 200-300 rows. When I print it to PDF, the pdf would contain 1+ pages (about 55 rows per page). I am tring to define a header that would have same columns (essentially name of the each col of the datatable) on all the pages. For the numeric data, I would like the alignment to be right aligned in the header. This does not seem to work. I get the data to be aligned right.

Can you pl help?

I am using v3.3 on .Net 1.1.

Regards,

-j-

1 Reply

AD Administrator Syncfusion Team February 21, 2007 10:12 AM UTC

Hi Jonam,

Thanks for your interest in Essential PDF.

You cannot set the text alignment of header by using header.Graphics.DrawText. It can be possible by using header.Graphics.DrawMultiText.

//Set the header Textalignment as right
props.TextAlignment = TextAlignment.Right;
Rectangle rect = new Rectangle( 0,0,(int)doc.LastPage.DrawingWidth-10,40);
header.Graphics.DrawMultiText( rect,title, font, props );

//Set the table header Textalignment as right
table.Header[0].Cells[i].Style.TextAlignment = TextAlignment.Right;

You can repeat the header for all pages by using RepeatHeader property

//For repeating the header to all pages

table.RepeatHeader = true;

Kindly try running the attached sample and let me know if you have any other queries.

Best Regards,
Bhuvaneswari


sampleHeaderalign.zip

Loader.
Up arrow icon