How to find and replace text in word files both doc and docx
<p>I want to find and replace text using Java in doc format and docx format files using Java.</p>

<p>What I tried: I tried reading those files as text files but didn't succeed. </p>

<p>I have no idea how to proceed or what else to try, can anyone give me direction?</p>