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

Easy Table Format Question

I have 2 Questions about table formatting:

1. I am unable to get the text in the table cells
to use a font that I set using:
table.Style.TextFont = MyFont

The text in the table will not change size and is always bold.

2. I am unable to set the cell border line width
using this:
table.Style.BordersWidth.All = 1

The above seems to set the outside table border width but does not set the borders around the cells.

Thanks,
Bill

5 Replies

AJ Ajish Syncfusion Team August 1, 2006 09:24 PM UTC

Hi Bill,

1) Use the following code to set size of the font to the whole table

IPDFFont tablefont=pdfDoc.Fonts.Add(FontBaseFamily.Courier);
tablefont.Size=8;
table.Style.TextFont =tablefont;

you can also set it to individual cells using the style property of the table cells. Here is a code for doing it

table.Rows[0].Cells[0].Style.TextFont =tablefont;

2) Use the following code to set Border width

table.Style.BordersWidth.All=0;

and to set the Borders of each cell you need to use the following code

table.Rows[nrow].Cells[ncols].Style.BordersWidth.All =0;

Note that PDF table model is designed to have a table border as well as borders to each cells.

Here is a sample for your reference:
Table.zip


Please take a look and let me know if you have any other questions.

Best Regards,
Ajish.


AD Administrator Syncfusion Team August 1, 2006 11:00 PM UTC

Thanks Ajish,
From your example I worked out what was happening, But it does not work as expected.

At the Begining of my application I create several IPDFFont objects - for example:
(VB)
Dim BigFont as IPDFFont = pdf.Fonts.Add(FontBaseFamily.TimesRoman)
BigFont.Size = 16

Dim LittleFont as IPDFFont = pdf.Fonts.Add(FontBaseFamily.TimesRoman)
LittleFont.Size = 8

As I need to print some text I use the Graphics.DrawMultiText Function and I send in either LittleFont or Bigfont as the font parameter and it works correctly and as expected.

With tables if I set the:

table.Style.TextFont = BigFont
or
table.Style.TextFont = LittleFont

it always uses the font that was added to the document last.

So for the example above I can set the

table.Style.TextFont = BigFont

but it always prints out as the LittleFont.

Can you clarify?
It does work if you explicitly format each cell.
So i can do that or make sure the font I want for my table was just added. I have attached an example.

Thanks,
Bill

Bill Table Test.zip


AJ Ajish Syncfusion Team August 1, 2006 11:35 PM UTC

Hi Bill,

Thank you for the sample. I was able to reproduce the issue. I have created a bug report regarding this issue, you can track the status of this issue from the following link:

http://www.syncfusion.com/support/issues/pdf/Default.aspx?ToDo=view&questId=2489

Please take a look and let me know if you have any questions.

Regards,
Ajish.


AD Administrator Syncfusion Team August 3, 2006 08:42 PM UTC

Ajish,
I''m sure you guys will see this immediately when you start looking at the problem - but I wanted to clarify a the bug a little more. We already know the table publishes with the last font added to the pdf document object and not through the Table.Style.TextFont property. But, that is not it exactly.

It publishes the table using the last font added to the document BEFORE you use the table.ImportDataTable method.

So, whatever font was last added to the document before you ImportDataTable is the font that will be used to publish the Table.

Hope this helps,
Bill


AJ Ajish Syncfusion Team August 3, 2006 10:22 PM UTC

Hi Bill,

Thank you for the information. I have added your comments to this bug reports.

Thanks,
Ajish.

Loader.
Live Chat Icon For mobile
Up arrow icon