How can I fix my code so that it still deletes indentations, but doesn't delete numbers in tables, etc. in DXL?

24 views Asked by At

I am working on fixing a code that was developed to delete rich text from the database, but when I try to run it to delete only indentations, it tends to delete other formatting things such as bullet points, numbers in table, and numbers in other attributes. How can I fix this so it only deletes the indentations?

Here are a couple things that I tried:

  1. I created a string that would read the object text of the current object it's being run through and used the following line of code in a cause where I wanted to get rid of indentations but keep bullets. I also looped this through a for richtext in string do. s = applyTextFormattingToParagraph(richText s, true, 0, 0) This code changed nothing with the outcome.
  2. I also tried using rich text properties inside the if statement of removing identations but keeping bullets to reapply the bullets after they have been removed and this has done nothing.
1

There are 1 answers

1
Mike On

I don't have a working example, am not fluent with RTF and did not try the following. Just a wild guess: perhaps you have to iterate over each RTP of each RT of the string and apply the text formatting to each single paragraph that you want to change? Something like:

Object o
string richTextString
RichText rt
RichTextParagraph rtp

for o in module do {
  richTextString = richText (o."Object Text") // or other attribute containing RTF
  string newString = ""
  for rt in richTextString do {
    int paraNumber = 0
    for rtp in rt do {
      paraNumber++
      if (rtp.indentLevel > 0) {
        newString = newString applyTextFormattingToParagraph(rtp, rtp.isBullet, 0, paraNumber) 
      } else {
        newString = newString rtp

etc. etc. and finally set object text to the newString.