Hello,
I have a flow that reads an xml file, that is based on a Word document stored in SharePoint, processes the text from the Word document as a string and stores it within a content control in another Word document. I've had to manipulate the string using the split function and created an array to remove text characters I don't want. This works fine and the rest of the flow does what it needs to do.
However, is there a way to modify the xpath step to capture all of the text in the Word document's XML file including the formatting from the original document?
It has proven to be challenging to get the xml data to display consistently after it's processed as a string and stored in the other Word document content control. The current expression I've been using is below. I've tried replacing the "w:t" with "w:r", "w:body", and "w:color" but I've had no luck. Ultimately, when a new document is created from within my flow, I would like the content control within that document to display with all of the information and formatting from the xml file of the original document. I appreciate any guidance or suggestions.
I got this working by using
xpath(xml(outputs('Get_file_content')),'//*[local-name()="t"]/text()')
Since power automate doesn't support namespaces, it seems you can use the "local-name" and exclude the namespace.
Hope this helps. Spent a lot of time getting this to work for my own project.
Edit: Added "/text()" to the second xpath parameter
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
13 |
User | Count |
---|---|
127 | |
54 | |
38 | |
24 | |
21 |