We have a number of Rich-Text fields (multi-line) that users type data into. So they might format the color of the text, the font size etc.

The formatting looks like this in SharePoint:

enter image description here

We have a tool extracting information from SharePoint Online and convert it into a report of some sort. The selected formatting should be preserved.

Our problem is that the applied style is not saved as "inline CSS styles" in the Rich Text. Sadly, a reference to "internal" SharePoint CSS-classes is used, and our external tool has no way to tell what those classes mean.

The HTML created by the Rich-Text editor is this:

   <strong class="ms-rteThemeForeColor-6-4 ms-rteFontSize-4">​do
    <span class="ms-rteFontSize-1" style="text-decoration: underline;">ubl</span>e
   <strong class="ms-rteThemeForeColor-6-4 ms-rteFontSize-4">T
     <span style="color: #ff0000;">his </span>
     <span class="ms-rteThemeForeColor-9-3">is a te
       <span style="text-decoration: line-through;">st</span>

Notice how some of the formatting is done inline - like the #ff0000 color and the underline and strike-through, while others are done using CSS-classes.

The result of not knowing about the internal SharePoint classes is this:

enter image description here

So what can we do to fix this? Can we script/configure the RichText editor to use inline CSS styling always?

Your Answer

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

Browse other questions tagged or ask your own question.