List-Formatting icon indicating copy to clipboard operation
List-Formatting copied to clipboard

How to get the txtContent from an Multiple line text field - Enhanced rich text?

Open ltabosa opened this issue 8 years ago • 16 comments

Important

I want to show one column Multiple line of text in the list formatting. Right now is showing the HTML and not the rich text.

Category

  • [X] Question
  • [ ] Bug
  • [ ] Enhancement

Observed Behavior

image

Steps to Reproduce

Column config. image

JSON { "elmType": "div", "style": { "flex-grow": "1" }, "children": [ { "elmType": "span", "style": { "display": "block" }, "attributes": { "class": "ms-fontWeight-semibold ms-fontSize-m" }, "txtContent": "Answer:" }, { "elmType": "span", "style": { "display": "=if([$Answer] == '', 'none', 'block')", "padding-left": "8px" }, "txtContent": "=toString([$Answer])", "attributes": { "class": "ms-fontSize-s ms-fontWeight-regular ms-fontColor-neutralSecondary" } }, { "elmType": "span", "style": { "display": "=if([$Answer] == '', 'block', 'none')", "padding-left": "8px" }, "txtContent": "No answer entered", "attributes": { "class": "ms-fontSize-s ms-fontWeight-semilight ms-fontColor-neutralTertiary" } } ] }

ltabosa avatar Sep 19 '18 18:09 ltabosa

I'm struggling with the same issue. Can't seem to find out how to strip out the HTML and just show the formatted text.

aprildunnam avatar Oct 11 '18 19:10 aprildunnam

Any luck?

bestjeffever avatar Oct 18 '18 15:10 bestjeffever

Unfortunately, there is no way to do this currently. The value of enhanced/rich multiline text fields are returned from SharePoint as strings (not as HTML elements). The string values include all the HTML with the text content embedded within. There are no alternative values that just contain the text.

There is no support for accessing a DOMParser to turn this from a string into HTML elements within column formatting. Even then, you would need to traverse the result and retrieve the text values (strip out the HTML) by using operations that are not available within column formatting.

This has far more to do with how SharePoint stores and returns values for these types of fields than any real limitation with column formatting. For this kind of advanced processing, a SharePoint Framework Field Customizer would be the right solution.

thechriskent avatar Oct 18 '18 18:10 thechriskent

Say it ain't so, @thechriskent! I was sure you'd have some magic dust to sprinkle on this one.

sympmarc avatar Oct 18 '18 18:10 sympmarc

Hope we get something for this

harshdamaniahd avatar Feb 18 '19 20:02 harshdamaniahd

Can we please reopen this ticket?

rodchenkov avatar Mar 12 '20 17:03 rodchenkov

This is a question regarding out of the box list formatting. This issues list is for issues pertaining to the samples in this repository.

If you would like Microsoft to implement something to address this limitation please create a suggestion on SharePoint Development User Voice. Reopening this issue will have no impact on how things work. Thanks!

thechriskent avatar Mar 13 '20 14:03 thechriskent

This suggestion seems related and has almost 150 votes: https://feedbackportal.microsoft.com/feedback/idea/fff8f364-de1c-ec11-b6e7-0022481f8914

tomresing avatar Jul 15 '22 21:07 tomresing

@tomresing if you don't mind, replicate this request in feedback for Microsoft Lists. https://feedbackportal.microsoft.com/feedback/idea/445d79c1-6906-ed11-a81b-6045bd864d4f

aaclage avatar Jul 18 '22 07:07 aaclage

Do we have solution or workaround for this issue?

gretchunkim avatar Sep 20 '22 17:09 gretchunkim

no workaround yet.

aaclage avatar Sep 20 '22 19:09 aaclage

My case was trying to re-use the Description field in a Document Library (for videos). The Description field for the built-in video viewer actually uses an internal field called _ExtendedDescription.

I found that you can edit the Description field records (_ExtendedDescription) via Edit in grid view where this doesn't apply DOM elements or styling (wahoo). An alternative is PowerApps form. Doing it one of these ways display well in formatted views and the native video viewer. IE "txtContent": "[$_ExtendedDescription]": no DOM elements or formatting issue.

j-te avatar Aug 02 '23 10:08 j-te

This suggestion seems related and has almost 150 votes: https://feedbackportal.microsoft.com/feedback/idea/fff8f364-de1c-ec11-b6e7-0022481f8914

Has this issue been deleted? Both this and the Lists one 404 for me.

gormster avatar Oct 25 '23 06:10 gormster

@gormster I can't reach either, though I think the Lists link was meant to link to the Lists area of the portal.

tomresing avatar Oct 25 '23 18:10 tomresing

Any progress on this? I would like to use the JSON to keep the rich text editor from putting everything in Calibri 11 instead of Segoe UI 11... Another "annoyance" from Sharepoint Lists...

stuffi3000 avatar Jan 04 '24 16:01 stuffi3000

This is still an issue? Any workarounds on rendering HTML in listview or SPFX web parts?

sudhirke avatar Sep 01 '25 14:09 sudhirke