Word Action Output duplicate HTML

I really like to new “Word” action, however, when the word document is generated, the “Numbers/ list” and “Bullet-points” are always duplicated.

I would appreciate if anyone can fix this, or have a work around

@nathaniel please check this one out

Hi @sean_pope,

If you clone the action and look into the code you can change how you want the lists to be displayed. You can for example remove the "• "

I tried that, but most times it breaks the code i get an error, or when i just delete it, it removes all the text which are shown under the bullet point section of the output, I cannot delete the one for the numbers because it just breaks it,

Can you assist with modifying the code please, im not an expert on the code aspect of things.

I was hoping that the default “Word Action” does not have this bug, because everyone will be facing the same problem by default

@sean_pope something like this?

To get this output you can change the ul ol part of the code as follows:

elif element.name == "ul":
            for li in element.find_all("li"):
                text = li.get_text(strip=True)
                if not text.startswith("•"):  # Avoid adding extra bullets
                    doc.add_paragraph(text, style="List Bullet")
                else:
                    doc.add_paragraph(text)  # If it's already formatted, just add it
        elif element.name == "ol":
            for i, li in enumerate(element.find_all("li"), start=1):
                text = li.get_text(strip=True)
                if not text.lstrip().startswith(f"{i}."):  # Avoid extra numbering
                    doc.add_paragraph(text, style="List Number")
                else:
                    doc.add_paragraph(text)  # If it's already formatted, just add it
1 Like