Java 类net.sf.jasperreports.engine.export.JRXhtmlExporter 实例源码

项目:PDFReporter-Studio    文件:ExportAsXHtmlAction.java   
@Override
protected JRXhtmlExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) {
    JRXhtmlExporter exp = new JRXhtmlExporter(jContext);
    exp.setExporterOutput(new SimpleHtmlExporterOutput(file));

    SimpleHtmlReportConfiguration rconf = new SimpleHtmlReportConfiguration();
    setupReportConfiguration(rconf, monitor);
    exp.setConfiguration(rconf);

    return exp;
}
项目:io-addon    文件:JasperRenderer.java   
/**
 * Exports by MIME type.
 *
 * @param mimeType MIME type
 * @param jp       Jasper print
 * @param os       outputstream
 * @throws JRException
 */
protected void export(String mimeType, JasperPrint jp, OutputStream os) throws JRException {
    if ("application/pdf".equalsIgnoreCase(mimeType)) {
        exportReport(new JRPdfExporter(), jp, os);

    } else if ("text/xml".equalsIgnoreCase(mimeType)) {
        exportReport(new HtmlExporter(), jp, os);

    } else if ("application/rtf".equalsIgnoreCase(mimeType)) {
        exportReport(new JRRtfExporter(), jp, os);

    } else if ("application/xls".equalsIgnoreCase(mimeType)) {
        exportReport(new JRXlsExporter(), jp, os);

    } else if ("application/odt".equalsIgnoreCase(mimeType)) {
        exportReport(new JROdtExporter(), jp, os);

    } else if ("application/ods".equalsIgnoreCase(mimeType)) {
        exportReport(new JROdsExporter(), jp, os);

    } else if ("application/docx".equalsIgnoreCase(mimeType)) {
        exportReport(new JRDocxExporter(), jp, os);

    } else if ("application/xlsx".equalsIgnoreCase(mimeType)) {
        exportReport(new JRXlsxExporter(), jp, os);

    } else if ("application/pptx".equalsIgnoreCase(mimeType)) {
        exportReport(new JRPptxExporter(), jp, os);

    } else if ("text/xhmtl".equalsIgnoreCase(mimeType)) {
        exportReport(new JRXhtmlExporter(), jp, os);
    } else {
        throw new IllegalArgumentException("JasperRenderer does not support " + mimeType + " MIME type.");
    }
}
项目:jasperreports-wms-component    文件:WmsMapElementHtmlHandler.java   
@Override
public String getHtmlFragment(JRHtmlExporterContext context,
    JRGenericPrintElement element) {

  Map<String, Object> contextMap = new HashMap<String, Object>();
  contextMap.put("mapCanvasId", "map_canvas_" + element.hashCode());

  if (context.getExporter() instanceof JRXhtmlExporter) {
    contextMap.put("xhtml", "xhtml");
    JRXhtmlExporter xhtmlExporter = (JRXhtmlExporter) context.getExporter();
    contextMap.put("elementX", xhtmlExporter.toSizeUnit(element.getX()));
    contextMap.put("elementY", xhtmlExporter.toSizeUnit(element.getY()));
  } else {
    JRHtmlExporter htmlExporter = (JRHtmlExporter) context.getExporter();
    contextMap.put("elementX", htmlExporter.toSizeUnit(element.getX()));
    contextMap.put("elementY", htmlExporter.toSizeUnit(element.getY()));
  }
  contextMap.put("elementId", element.getKey());
  contextMap.put("elementWidth", element.getWidth());
  contextMap.put("elementHeight", element.getHeight());

  if (element.getModeValue() == ModeEnum.OPAQUE) {
    contextMap.put("backgroundColor",
        JRColorUtil.getColorHexa(element.getBackcolor()));
  }
  WmsRequestBuilder requestBuilder =
      WmsMapElementImageProvider.mapRequestBuilder(element);
  try {
    contextMap.put("wmsMapUrl", requestBuilder.toMapUrl());
  } catch (MalformedURLException e) {
    throw new RuntimeException("Unable to build WMS map service url", e);
  }

  return VelocityUtil.processTemplate(MAP_ELEMENT_HTML_TEMPLATE, contextMap);
}
项目:PDFReporter-Studio    文件:ScriptletApp.java   
/**
 *
 */
public void xhtml() throws JRException
{
    long start = System.currentTimeMillis();
    File sourceFile = new File("build/reports/ScriptletReport.jrprint");

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

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

    JRXhtmlExporter exporter = new JRXhtmlExporter();

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

    exporter.exportReport();

    System.err.println("XHTML creation time : " + (System.currentTimeMillis() - start));
}
项目:opennmszh    文件:JRobinQueryExecuterTest.java   
/**
 *
 */
public void xhtml() throws JRException
{
    long start = System.currentTimeMillis();

    File destFile = new File("target/reports/RrdGraph.x.html");

    JRXhtmlExporter exporter = new JRXhtmlExporter();

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

    exporter.exportReport();

    System.err.println("XHTML creation time : " + (System.currentTimeMillis() - start));
}
项目:enterprise-app    文件:AbstractReport.java   
public void exportToHtml() {
    download(getFileName() + ".html", new JRXhtmlExporter());
}
项目:konekti    文件:TemplateComponentReport.java   
public void exportToHtml() {
    download(getFileName() + ".html", new JRXhtmlExporter());
}
项目:konekti    文件:GridComponentReport.java   
public void exportToHtml() {
    download(getFileName() + ".html", new JRXhtmlExporter());
}
项目:jasperreports-wms-component    文件:ExtensionsRegistryFactory.java   
@Override
public GenericElementHandler getHandler(String elementName,
    String exporterKey) {
  if (WmsMapPrintElement.WMS_MAP_ELEMENT_NAME.equals(elementName)) {
    if (JRGraphics2DExporter.GRAPHICS2D_EXPORTER_KEY
        .equals(exporterKey)) {
      return WmsMapElementGraphics2DHandler.getInstance();
    }
    if (JRHtmlExporter.HTML_EXPORTER_KEY.equals(exporterKey)
        || JRXhtmlExporter.XHTML_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementHtmlHandler.getInstance();
    }
    else if (JRPdfExporter.PDF_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementPdfHandler.getInstance();
    }
    else if (JRXlsExporter.XLS_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementXlsHandler.getInstance();
    }
    else if (JExcelApiExporter.JXL_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementJExcelApiHandler.getInstance();
    }
    // else
    // if(JExcelApiMetadataExporter.JXL_METADATA_EXPORTER_KEY.equals(exporterKey))
    // {
    // return MapElementJExcelApiMetadataHandler.getInstance();
    // }
    else if (JRXlsxExporter.XLSX_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementXlsxHandler.getInstance();
    }
    else if (JRDocxExporter.DOCX_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementDocxHandler.getInstance();
    }
    else if (JRPptxExporter.PPTX_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementPptxHandler.getInstance();
    }
    else if (JRRtfExporter.RTF_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementRtfHandler.getInstance();
    }
    else if (JROdtExporter.ODT_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementOdtHandler.getInstance();
    }
    else if (JROdsExporter.ODS_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementOdsHandler.getInstance();
    }
  }
  return null;
}
项目:jasperreports-wms-component    文件:ComponentsExtensionsRegistryFactory.java   
@Override
public GenericElementHandler getHandler(String elementName,
    String exporterKey) {
  if (WmsMapPrintElement.WMS_MAP_ELEMENT_NAME.equals(elementName)) {
    if (JRGraphics2DExporter.GRAPHICS2D_EXPORTER_KEY
        .equals(exporterKey)) {
      return WmsMapElementGraphics2DHandler.getInstance();
    }
    if (JRHtmlExporter.HTML_EXPORTER_KEY.equals(exporterKey)
        || JRXhtmlExporter.XHTML_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementHtmlHandler.getInstance();
    }
    else if (JRPdfExporter.PDF_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementPdfHandler.getInstance();
    }
    else if (JRXlsExporter.XLS_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementXlsHandler.getInstance();
    }
    else if (JExcelApiExporter.JXL_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementJExcelApiHandler.getInstance();
    }
    // else
    // if(JExcelApiMetadataExporter.JXL_METADATA_EXPORTER_KEY.equals(exporterKey))
    // {
    // return MapElementJExcelApiMetadataHandler.getInstance();
    // }
    else if (JRXlsxExporter.XLSX_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementXlsxHandler.getInstance();
    }
    else if (JRDocxExporter.DOCX_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementDocxHandler.getInstance();
    }
    else if (JRPptxExporter.PPTX_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementPptxHandler.getInstance();
    }
    else if (JRRtfExporter.RTF_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementRtfHandler.getInstance();
    }
    else if (JROdtExporter.ODT_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementOdtHandler.getInstance();
    }
    else if (JROdsExporter.ODS_EXPORTER_KEY.equals(exporterKey)) {
      return WmsMapElementOdsHandler.getInstance();
    }
  }
  return null;
}
项目:OpenNMS    文件:JRobinQueryExecuterTest.java   
/**
 *
 */
public void xhtml() throws JRException
{
    long start = System.currentTimeMillis();

    File destFile = new File("target/reports/RrdGraph.x.html");

    JRXhtmlExporter exporter = new JRXhtmlExporter();

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

    exporter.exportReport();

    System.err.println("XHTML creation time : " + (System.currentTimeMillis() - start));
}
项目:opennmszh    文件:ResourceQueryExecuterTest.java   
private void xhtml() throws JRException {
    File destFile = new File("target/reports/ResourceTypeTest.x.html");

    JRXhtmlExporter exporter = new JRXhtmlExporter();

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

    exporter.exportReport();
}
项目:OpenNMS    文件:ResourceQueryExecuterTest.java   
private void xhtml() throws JRException {
    File destFile = new File("target/reports/ResourceTypeTest.x.html");

    JRXhtmlExporter exporter = new JRXhtmlExporter();

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

    exporter.exportReport();
}