code: public static String getText(R run) {
          String result = "";
          for (Object content : run.getContent()) {
              if (content instanceof JAXBElement) {
                  JAXBElement element = (JAXBElement) content;
                  if (element.getValue() instanceof Text) {
                      Text textObj = (Text) element.getValue();
                      String text = textObj.getValue();
                      if (!"preserve".equals(textObj.getSpace())) {
                          // trimming text if spaces are not to be preserved (simulates behavior of Word; LibreOffice seems
                          // to ignore the "space" property and always preserves spaces)
                          text = text.trim();
                      }
                      result += text;
                  }else if (element.getValue() instanceof R.Tab){
                      result += "\t";
                  }
              } else if (content instanceof Text) {
                  result += ((Text) content).getValue();
              }
          }
          return result;
      }
docs: Returns the text string of a run.
  
  @param run the run whose text to get.
  @return String representation of the run.