Hi,
I am trying to read multiple word documents around 7 and would like to check if they contain the word “Dutch” within the documents. Can someone help?
Kind regards,
Hi,
I am trying to read multiple word documents around 7 and would like to check if they contain the word “Dutch” within the documents. Can someone help?
Kind regards,
try this in if condition
Path.GetFileNameWithoutExtension(item).Contains("Dutch")
Change your item type to String in foreach OR just add ToString at the end in if condition.
The IF condition looks like Path.GetFileNameWithoutExtension(item.ToString).contains("Dutch")
But when I run the process all 8 documents within the folder bring the message box “NO” but I know 5 documents contain the word “Dutch”. Do you know why it isn’t working?
Probably lower case? “dutch”?
No it didn’t work. I have tried different words with upper and lower case. It just doesn’t seem to read the document.
Can you write line the item.ToString and share the screenshot?
I want to see the output.
When I run the process, I have to choose the folder. When I select the folder I want. It then gives me a message box stating “NO” then I click “ok” on the message box 8 times as I have 8 word documents in the folder and that’s it.
Please upload a screenshot where the Output pane is visible (bottom left corner) and shows the result of item.ToString.
Correct. What keyword are you expecting to be in the file name in this case?
My process should read all 8 documents in the folder and check whether the word “Dutch” in contained within the documents if so, I will carry on with the process. Hope that makes sense.
Understood, you want “Dutch” word inside the document.
Perfect! It works. Thanks.