private static void replaceParagraphWithPreface(final Context context, final XWPFParagraph paragraph) {
        try (final CursorHelper cursorHelper = context.newCursorHelper(paragraph)) {
            // TODO insert preface
        } finally {
            context.getDocument().removeBodyElement(context.getDocument().getPosOfParagraph(paragraph));
        }
    }
private static void replaceParagraphWithPreface(final Context context, final XWPFParagraph paragraph) {
        try (final CursorHelper cursorHelper = context.newCursorHelper(paragraph)) {
           
        } finally {
            context.getDocument().removeBodyElement(context.getDocument().getPosOfParagraph(paragraph));
        }
    }
private static void replaceparagraphwithpreface(final context context, final xwpfparagraph paragraph) { try (final cursorhelper cursorhelper = context.newcursorhelper(paragraph)) { } finally { context.getdocument().removebodyelement(context.getdocument().getposofparagraph(paragraph)); } }