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.

Easy Table Format Question

Thread ID:

Created:

Updated:

Platform:

Replies:

47282 Aug 1,2006 04:27 PM Aug 3,2006 06:22 PM Windows Forms 5
loading
Tags: PDF
Administrator [Syncfusion]
Asked On August 1, 2006 04:27 PM

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

Ajish [Syncfusion]
Replied On August 1, 2006 05:24 PM

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.

Administrator [Syncfusion]
Replied On August 1, 2006 07:00 PM

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

Ajish [Syncfusion]
Replied On August 1, 2006 07:35 PM

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.

Administrator [Syncfusion]
Replied On August 3, 2006 04:42 PM

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

Ajish [Syncfusion]
Replied On August 3, 2006 06:22 PM

Hi Bill,

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

Thanks,
Ajish.

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.

;