Delete paragraphs

From NOA Documentation Wiki

Jump to: navigation, search

Source: http://ubion.ion.ag/mainForumFolder/noa_forum/0067

Changes done by Jstaerk 12:20, 25 November 2007 (CET): added [], [i] and try...catch

   try {

          ITextDocument textDocument = (ITextDocument)document;
          IParagraph paragraphs[] = textDocument.getTextService().getText().getTextContentEnumeration().getParagraphs();
          for(int i = 0; i < paragraphs.length; i++) {
               XTextContent textContent = paragraphs[i].getXTextContent();
               XTextTable xTextTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class, textContent);
               if(xTextTable == null) /*contains no table*/ textContent.dispose();
          }
       } catch (TextException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
       } 
Personal tools