code: int getNumberOfAllTextParagraphs() {
      try {
        if (xPCursor == null) {
          return 0;
        }
        xPCursor.gotoStart(false);
        int nPara = 1;
        while (xPCursor.gotoNextParagraph(false)) nPara++;
        return nPara;
      } catch (Throwable t) {
        MessageHandler.printException(t);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
        return 0;              // Return 0 as method failed
      }
    }
docs: Returns Number of all Paragraphs of Document without footnotes etc.
  Returns 0 if it fails