We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting text to Title Case

I am adding text to a Word document. How can I set the case of the text of the Run to Title Case?
This message was posted using Aspose.Live 2 Forum

Hi Malieka,

Thanks for your inquiry.

I think the example under StyleIdentifier here may help you. If this is not what you are looking for could you please attach your code here for testing?

Thanks,

I not looking for a style. I am looking to change the case of the text to Title Case, which is akin to Uppercase, Lowercase, Sentence Case, etc. You can change the case of selected text by choosing "Change Case" from the Format menu in Word. Essentially, I want to capitalize the first letter of each word. I don't think the code will provide much information, but here it is:

run.Text = NameSearchString + ":" + Position;

The variables contain strings that are all Uppercase. I was just wondering if there was a way to apply initial caps to the text of the run.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. There are properties of font that allow inserting text as AllCaps and SmallCaps:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.font.allcaps.html

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.font.smallcaps.html

When you the change case of text in MS Word through Format menu, MS Word just reformats the string. You can do the same before inserting the text into the document.

string text = "This is my text";

string textTitle = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(text);

Please see the following link for more information:

http://support.microsoft.com/kb/312897

Best regards,

Thanks. That’s what I thought. I just wanted to confirm that I wasn’t missing anything in the Aspose.Words library that could do that. Thank you.