How to Lineup numbers correctly in word document using UIPATH

Hi Team,

I have a scenario where my word file contains values as:
1.Policy
2.Agent
4.Result

I want to display it as:
1.Policy
2.Agent
3.Result

Appreciate your help guys!

@avejr748 @william.coulson

Hi @RajeshT,

Do you have a screenshot of the word document? You could try and use .Replace to replace the 4 with a 3?

Var1 = Var1.Replace("4","3")

Also, please try and refrain from tagging users in your topic posts :smiley:

2 Likes

Hi @william.coulson,

Noted on tagging!
Actually the Lineup numbers are dynamic,sometime there will 9 rows with not linuped correctly.
image

@RajeshT,

What I’m getting from this is that there will be a list of words, prefixed with numbers and . , and the numbers won’t be in order? What else features on the word document, or is it just the list of words?

1 Like

Hi @RajeshT,

Try this workflow. It reads the text in a word document, splits it by . , then removes instances of line breaks and numbers, then writes it all back into the word document. My word document only contains the list of words.

Main.xaml (9.4 KB)

I will let you build the part that opens the word document up and then numbers the lines produced.

1 Like

Hi @william.coulson,

The solution you provided deleting the numbers from the word document.
But my Word document contains other sentences also ,can we do within the document?

@RajeshT
This one worked for me. Try this workflow and let me know if it works for you.
Main.xaml (9.2 KB)

1 Like

Hi @poorna_nayak07,

Thank you for your respose.

Actually my document having other paragraphs also,i tried with our xaml and its not getting result as expected.
image

@RajeshT,

You can run the workflow I made and then manually find the lines in which the numbers have been removed and use the Numbering tool on Word to number them. Not ideal but then the numbers will be in the right order

2 Likes

Thank you @william.coulson!!

@RajeshT,
I have prepared one solution Main.xaml (8.8 KB) by assuming each paragraph starts with random numbers.

Regards,
Poorna

1 Like

Thank you so much @poorna_nayak07.
Its working as my expectation.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.