title: Apache POI get line breaks from XWPFRun
body: <p>I have a problem reading whitespaces from a docx file using Apache POI 3.15. I have a Word document with line breaks in it, when reading the file via apache poi I cannot find a way to get those linebreaks. When I Call <code>paragraph.getParagraphText()</code> the Text is returned with the line breaks. When I iterate over the XWPFRun objects I only get the text and formatting, but no information about line breaks. </p>
  
  <p>This is the code I use. The br,tab,cr and separator lists are always empty. </p>
  
  <pre><code>        XWPFDocument document = new XWPFDocument(fis);
      List&lt;XWPFParagraph&gt; paragraphs = document.getParagraphs();
  
      for(XWPFParagraph paragraph : paragraphs) {
          //System.out.println(paragraph.getParagraphText());
          for(XWPFRun run : paragraph.getRuns()) {
              CTR ctr = run.getCTR();
              List&lt;CTBr&gt; brList = ctr.getBrList();
              List&lt;CTEmpty&gt; tabList = ctr.getTabList();
              List&lt;CTEmpty&gt; crList = ctr.getCrList();             
              List&lt;CTEmpty&gt; separatorList = ctr.getSeparatorList();
              String text = run.getText(run.getTextPosition());
              String color =run.getColor();
              boolean bold = run.isBold();
              boolean italic = run.isItalic();
              System.out.println("text: " + text + " color: " + color + " bold: " + bold + " italic: " + italic); 
  
              for(CTEmpty cr : crList) {
                  System.out.println(cr);
              }
          }           
      }
  </code></pre>
  
  <p>Is using the CTR Object to correct way to go or is there another way to get those linebreaks? </p>
  
  <p><a href="https://i.stack.imgur.com/uLsjl.png" rel="nofollow noreferrer">Word Example</a></p>