Removal of special characters in a cell in Modern SharePoint Library

Copper Contributor

Hi Everyone,

 

So I have a document library where the customer wanted to manually create indented subtasks.  To do this, they added 5 dashes to specific items to create the appearance of indention.  They want these dashes removed, while maintaining an indention.  This is what it looks like:

 

SPTEST3_0-1621788632598.png

The Title column is just a single-line text column.  I want the bottom three entries (that have the dashes) to appear indented under the top entry.  But I obviously don't want the dashes.  I don't know if this is a JSON issue, or may a power automate workflow to get rid of the dashes.  Can I change the font of the dashes to white?

 

I'm just not sure.  Any help would be greatly appreciated.

 

Thanks!

 

Chris

2 Replies

@SPTEST3 I really don't think this is possible in the way your client wants it. There's no concept of sub-items and so anything you do, for example JSON formatting, will imact the first one, SD100 - Smithsonian Directives, in the same way as all the others. A flow in Power Automate can be used with the replace action to remove the dashes but it will not leave the space they took up. And you can't turn the dashes only to white - all the text will change to white. The Microsoft-provided way for doing this sort of stuff is to have a folder for SD100 - Smithsonian Directives and each of the other "top level" titles, and then put all the documents related to each one in the appropriate folder.

 

Rob
Los Gallardos
Intranet, SharePoint, Website and Power Platform Manager (and classic 1967 Morris Traveller driver)

 

 

@RobElliott 

 

Thank you very much for your reply.  It's definitely a weird request for sure.  I have this JSON formatting that works to remove the dashes:

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "span",
      "style": {
        "padding-left": "=if(@currentField startsWith '----', '25px',''"
      }
    },
    {
      "elmType": "span",
      "txtContent": "=replace([$FileLeafRef],'----','    '"
    }
  ]
}

 This works to remove the dashes.  However, it also removes the indent.  I'm hoping to just remove the dashes, and maintain the indent.  I don't know if it's possible to format specific cells like that though.