Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Wed May 11, 2016 7:44 am

Good morning,
I have several tables in my presentation created by Spire Presentation library. (which is great, btw)
All the tables has fixed font size in them - How can I change the font size?

Here an example of my code:

ITable table= slide2.Shapes.AppendTable(RIGHT_TITLE_X+10, 100, Table_Widths, Table_heights);
string[] tableHeaders = { "one", "two" };

table[0, 0].TextFrame.Text = tableHeaders[0];
table[0, 0].FillFormat.SolidColor.Color = Color.LightSkyBlue;
table[1, 0].TextFrame.Text = tableHeaders[1];
table[1, 0].FillFormat.SolidColor.Color = Color.LightSkyBlue;

and so on...

Many Thanks,
Sammy

semyonest
 
Posts: 2
Joined: Wed May 11, 2016 7:40 am

Wed May 11, 2016 8:00 am

Hi,

Thanks for your posting.
Please try FontHeight property.
Code: Select all
 table[1, 0].TextFrame.TextRange.FontHeight = 20;


Hope this answers your question. Let me know if further detail/explanation would be helpful.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Fri May 13, 2016 7:27 am

Hi,

Has your issue been resolved?
Thanks for your feedback in advance.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Fri May 13, 2016 6:17 pm

Yes it just what I needed.
Thank you very much for your professional & quick response.

semyonest
 
Posts: 2
Joined: Wed May 11, 2016 7:40 am

Mon May 16, 2016 1:51 am

Hi,

Glad to help you. Welcome to write to us again for further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Tue Jun 12, 2018 11:22 am

Hello
Can I set font for whole table?

amy.zhao wrote:Hi,

Thanks for your posting.
Please try FontHeight property.
Code: Select all
 table[1, 0].TextFrame.TextRange.FontHeight = 20;


Hope this answers your question. Let me know if further detail/explanation would be helpful.

Best Regards,
Amy
E-iceblue support team

rokaf
 
Posts: 37
Joined: Thu May 10, 2018 9:30 am

Wed Jun 13, 2018 2:35 am

Hello,

Thank you for your inquiry.
To set the font for the whole table, you need to loop the cells like below.
Code: Select all
 for (int i = 0; i < table.TableRows.Count; i++)
 {
     for (int j = 0; j < table.TableRows[i].Count; j++)
     {
         SetFontforCell(table, i, j);     
     }
 }

private static void SetFontforCell(ITable table, int i, int j)
{
    foreach (TextParagraph para in table[j, i].TextFrame.Paragraphs)
    {
        foreach (TextRange txtRange in para.TextRanges)
        {
            txtRange.LatinFont = new TextFont("Arial");
        }
    }
}


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Presentation

cron