Capitalize each word

Technical support for Presentation

Moderator: iceblue support

Capitalize each word

Postby stp_webdev » 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

Re: Capitalize each word

Postby Betsy.jiang » 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: 1320
Joined: Tue Sep 06, 2016 8:30 am


Return to Spire.Presentation

Who is online

Users browsing this forum: No registered users and 0 guests