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.

Tue May 02, 2017 10:28 am

I want to capitalize each word of table. i am using
table[j, i + 1].TextFrame.Paragraphs[0].TextRanges[0].TextCapType = TextCapType.Small;
, but its not working.
Can you please guide us.

stp_webdev
 
Posts: 15
Joined: Fri Apr 21, 2017 1:40 pm

Wed May 03, 2017 8:55 am

Dear stp_webdev,

Thanks for your inquiry.
After investigation, we found there is no direct way to set that. But there is other solution can meet your requirement.
Please split the text in table cell, and then change the first character of each word to upper. Here is code snippet for your kind reference.
Code: Select all
            string text = table[i, j].TextFrame.Paragraphs[0].Text;
            table[i, j].TextFrame.Paragraphs[0].Text = CapitalizeEachWord(text);
                               ...
            public static string CapitalizeEachWord(string sentence)
            {
                var sa = sentence.Split(' ');
                for (var i = 0; i < sa.Length; i++)
                    sa[i] = sa[i].Substring(0, 1).ToUpper() + sa[i].Substring(1).ToLower();                               
                var sout = string.Join(" ", sa);
                return sout;
            }

Hope this helps. If there is still issue, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Presentation