本文整理汇总了Java中net.sf.jasperreports.engine.export.JRXhtmlExporter类的典型用法代码示例。如果您正苦于以下问题:Java JRXhtmlExporter类的具体用法?Java JRXhtmlExporter怎么用?Java JRXhtmlExporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRXhtmlExporter类属于net.sf.jasperreports.engine.export包,在下文中一共展示了JRXhtmlExporter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExporter
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
@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;
}
示例2: export
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
/**
* 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.");
}
}
示例3: getHtmlFragment
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
@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);
}
示例4: xhtml
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
/**
*
*/
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));
}
示例5: xhtml
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
/**
*
*/
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));
}
示例6: exportToHtml
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
public void exportToHtml() {
download(getFileName() + ".html", new JRXhtmlExporter());
}
示例7: getHandler
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
@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;
}
示例8: xhtml
import net.sf.jasperreports.engine.export.JRXhtmlExporter; //导入依赖的package包/类
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();
}