title: How to find and write a line of a .doc file via apache poi?
body: <p>I have a "replaceText" method that writes data to the generated file. This does not read the paragraph. You need to get a paragraph so that he can find the desired marker. I can’t understand that he receives the first - a paragraph or a text?</p>
  
  <pre><code>for (XWPFParagraph p : xdoc.getParagraphs()) {
          for (XWPFRun r : p.getRuns()) {
              String text = r.getText(0);
              if (text != null &amp;&amp; text.length() &gt; 0) {
                  String msg = param.get(text.trim());
                  if (msg != null) {
                      text = text.replace(text.trim(), msg);
                      r.setText(text, 0);
                  }
              }
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/uFPoA.png" rel="nofollow noreferrer">enter image description here</a></p>