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
close icon

formatting text in PDF tables

Is there any way to specify "left-justify", "right-justify", or "center-justify" for text in the PDF tables? (I checked all the samples this time, and I couldn''t find it).

4 Replies

JM Jesse Marek May 12, 2006 03:13 PM UTC

I found out how to do it for the whole table (the DefaultCellStyle.TextAlignment property); how about for individual cells?


AJ Ajish Syncfusion Team May 12, 2006 04:32 PM UTC

Hi Jesse, Yes, we do have options to set text alignment properties for individual table cells. Use the following code to set text alignment. // Set cell text alignment table.Rows[0].Cells[0].Style.TextAlignment =TextAlignment.Left; // Set cell line alignment. table.Rows[0].Cells[0].Style.LineAlignment =LineAlignment.Middle; // Set header cell text alignment. table.Header[0].Cells[j].Style.TextAlignment =TextAlignment.Center; table.Header[0].Cells[j].Style.LineAlignment =LineAlignment.Middle; Here is a sample for your reference: FormatTables.zip Thanks, Ajish. >I found out how to do it for the whole table (the DefaultCellStyle.TextAlignment property); how about for individual cells?


JM Jesse Marek May 12, 2006 08:25 PM UTC

Thanks. I guess I''m getting too dependent on the auto-complete feature of the Visual Studio.NET IDE when searching for features in a new library. It won''t auto-complete after table.Rows[0].Cells[0] because "Cells" is overloaded to take a list of "ITableCell"s or "object"s.


AJ Ajish Syncfusion Team May 15, 2006 06:34 AM UTC

Hi Jesse, Sorry for the delay in getting back to you, I was able to see that table.Rows[0].Cells[0] is not shown in the auto complete wizard. I have notified the development team regarding this issue it will be fixed very soon. Please use the following peace of code, which will show up in the auto complete wizard of .net IDE. // To set table cell text alignment property. ITablelecell cell=table.Rows[0].Cells[0]; Cell.Style.TextAlignment =TextAlignment.Center; Please let me know if have any further queries regarding this. Thanks, Ajish. >Thanks. I guess I''m getting too dependent on the auto-complete feature of the Visual Studio.NET IDE when searching for features in a new library. > >It won''t auto-complete after table.Rows[0].Cells[0] because "Cells" is overloaded to take a list of "ITableCell"s or "object"s. >

Loader.
Live Chat Icon For mobile
Up arrow icon