Extract country name from word documents

Hi everyone,

I have a folder of word documents from which I need to extract the country names dynamically. Each file has just one country but multiple occurrences. I need to extract the first occurrence. Can someone please give a logic for this.

Thanks in advance

Hi @kumarmanjeetcr7
Try this
System.IO.Directory.GetFiles(“FilePath”, “*.xlsx”).ToList().Where(Function(a) a.Contains(“CountryName”)=True).FirstOrDefault()

Hope it helps :slight_smile:

Hi @kumarmanjeetcr7,

Check this xaml, it has the method to get all the country names in a list and check that list in each word document from the directory.

GetCountries.xaml (10.0 KB)

1 Like

Thanks @sarathi125. The .xaml file will really help me for other projects too

1 Like

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