public void exportElement(
      JRDocxExporterContext exporterContext,
      JRGenericPrintElement element,
      JRExporterGridCell gridCell) {
    JRDocxExporter exporter = (JRDocxExporter) exporterContext.getExporterRef();

    JRExporterGridCell newGridCell = getGridCellReplacement(exporterContext, element, gridCell);

    exporter.exportText(
        exporterContext.getTableHelper(), (JRPrintText) newGridCell.getElement(), newGridCell);
  }
 @Override
 public void exportElement(
     JRDocxExporterContext exporterContext,
     JRGenericPrintElement element,
     JRExporterGridCell gridCell) {
   JRDocxExporter exporter = (JRDocxExporter) exporterContext.getExporter();
   try {
     exporter.exportImage(
         exporterContext.getTableHelper(), getImage(exporterContext, element), gridCell);
   } catch (JRException e) {
     throw new RuntimeException(e);
   }
 }
  public void docx() throws JRException {
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/DataSourceReport.jrprint");

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

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

    JRDocxExporter exporter = new JRDocxExporter();

    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());

    exporter.exportReport();

    System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start));
  }
  public void docx() 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() + ".docx");

    JRDocxExporter exporter = new JRDocxExporter();

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

    exporter.exportReport();

    System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start));
  }