public void rtf() throws JRException {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/JRMDbReport.jrprint");

    JasperPrint jasperPrint = (JasperPrint) JRLoader.loadObject(sourceFile);

    File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");

    JRRtfExporter exporter = new JRRtfExporter();

    exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
    exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));

    exporter.exportReport();

    System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
  }
  public void save(JasperPrint jasperPrint, File file) throws JRException {
    if (!file.getName().toLowerCase().endsWith(EXTENSION_RTF)) {
      file = new File(file.getAbsolutePath() + EXTENSION_RTF);
    }

    if (!file.exists()
        || JOptionPane.OK_OPTION
            == JOptionPane.showConfirmDialog(
                null,
                MessageFormat.format(getBundleString("file.exists"), new Object[] {file.getName()}),
                getBundleString("save"),
                JOptionPane.OK_CANCEL_OPTION)) {
      JRRtfExporter exporter = new JRRtfExporter(getJasperReportsContext());
      exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
      exporter.setExporterOutput(new SimpleWriterExporterOutput(file));
      exporter.exportReport();
    }
  }