Get dollar amounts from a word document or pdf

uiautomation

#1

I have a word document of about 5 pages. In the word document, there’s a section that says 'Attorneys to be billed at $6, partners to be billed at $7, paralegals to be billed at $10. How do i get these dollar amounts separately? I want to get them out in this format- Attorneys = $6, partners =$7 paralegals = $10.


#2

Hi @Olaoluwa,

In this case your string standard format in the all the pages its easy to get the value using split option.
StrValue=" Attorneys to be billed at $6, partners to be billed at $7, paralegals to be billed at $10"

Create one array variable arrValue(string[])
arrValue=strValue.Split(","c)
After this you know 3 values need to get
1st value is
"Attorneys to be billed at $6"
Here you can replace the string
Attorneys= arrValue(0).ToString().Replace("Attorneys to be billed at ","")
The same way you can get the other values also.

Regards,
Arivu


#3

Thank you for your prompt reply. Is there a way to search for the word ‘Attorneys’ in the whole word document and then get the first occurence of the dollar amount and then do the same for partners and paralegals? So when it finds partners it then gets the first occuring dollar amount after the word 'partners?


#4

So for in this case you can use regex to get the data.

Regards,
Arivu


#5

Hi @Olaoluwa,
Regex.matches(“Your_String”,"$\d{1,}")(0)
By using this command you can get Amount value
after that iterate the output you can get the solution what you want
Regards,


#6

@Olaoluwa,

This might helps you along with arivu and hemanth solutions.

Input : Attorneys to be billed at $6, partners to be billed at $7, paralegals to be billed at $10

Code : ASSIGN String str = String.Join(" ",(From item In str1.Split(CChar(",")) Select item.Trim.Split(CChar(" ")).First+" = "+item.Trim.Split(CChar(" ")).Last))

Output : Attorneys = $6 partners =$7 paralegals = $10

Regards,
Dominic :slight_smile:


How to get sub-string from string-data, where sub-string is dynamic each time when it loads on a webpage?