Is it possible to format the contents of a column to show the first letter of every word entered as a capital or even format all the word to capital letters?
Is this possible via the JSON formatting option?
There is no straight forward function available in JSON formatting to capitalize the first letter of every word entered.
Capitalize first letter:
But, you can use CSS text-transform
in JSON formatting which returns all the words converted to capitalized first letter.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "[$Title]",
"style": {
"text-transform": "capitalize"
}
}
Output:
Capitalize whole word:
You can use toUpperCase()
function in JSON formatting which returns all the words converted to upper case.
Syntax:
"txtContent":"=toUpperCase('DogFood')"
>> results in "DOGFOOD".
Example:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=toUpperCase([$Title])"
}
Output:
Note:
Documentation: SharePoint JSON formatting Operators
The previous answer does not meet your needs. You are asking to capitalize the first letter of every word, not capitalize every letter in every word as your primary objective:
See this highly rated answer from a couple years ago: https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript
You will find an answer on that page.
Please mark as answer if this answers your question.