This example cuts the first paragraph, and then replaces the content of second paragraph with the first paragraph.
Selection selection = document.getSelection(); TextRange range = document.getParagraphs().item(1).getRange(); selection.setRange(range.getStart(), range.getEnd()); selection.cut(); range = document.getParagraphs().item(2).getRange(); selection.setRange(range.getStart(), range.getEnd()); selection.paste();