0

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?

1

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:

enter image description here


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:

**Output

Note:

  1. This only works on strings.
  2. Only available in SharePoint Online

Documentation: SharePoint JSON formatting Operators

2
  • Additional: You can capitalize first letter of each word using calculated formula, check this OR using Power automate, check this & this. Jan 7 at 7:11
  • Hi @mtagliaferri, did you try this solution? Is it working for you? Jan 14 at 11:47
-1

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.

3
  • OP is asking the solution using JSON formatting in SharePoint & not JavaScript (not feasible to inject script in modern experience). Also, OP mentioned or even format all the word to capital letters. Jan 7 at 6:55
  • Sir, he asked two questions in two separate, distinct sentences. just because you combined them to form a singular, convenient question does not mean you are correct in your reading. Jan 7 at 14:40
  • Let OP decide what he/she wants. I am not saying I am correct or you are wrong. Jan 7 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.