• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HtmlExporter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.sf.jasperreports.engine.export.HtmlExporter的典型用法代码示例。如果您正苦于以下问题:Java HtmlExporter类的具体用法?Java HtmlExporter怎么用?Java HtmlExporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HtmlExporter类属于net.sf.jasperreports.engine.export包,在下文中一共展示了HtmlExporter类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: saveHTMLReportToFile

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 * Generates an HTML report from a pre-compiled report and returns it into a file.
 * 
 * @param jasperPrint
 *          JasperPrint object which contains a compiled report.
 * @param exportParameters
 *          Export parameters than can be added to configure the resulting report.
 * @param file
 *          The file used to return the report.
 * @throws JRException
 *           In case there is any error generating the report an exception is thrown with the
 *           error message.
 */
private static void saveHTMLReportToFile(JasperPrint jasperPrint,
    Map<Object, Object> exportParameters, File file) throws JRException {
  final HtmlExporter htmlExporter = new HtmlExporter();
  SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
  SimpleHtmlExporterOutput exporterOutput = new SimpleHtmlExporterOutput(file);

  if (exportParameters != null && exportParameters.size() > 0) {
    SimpleHtmlReportConfiguration exportConfiguration = new SimpleHtmlReportConfiguration();
    setHtmlConfigurationFromExportParameters(exportParameters, exportConfiguration,
        exporterOutput);
    htmlExporter.setConfiguration(exportConfiguration);
  } else {
    SimpleHtmlReportConfiguration reportExportConfiguration = new SimpleHtmlReportConfiguration();
    reportExportConfiguration.setSizeUnit(HtmlSizeUnitEnum.POINT);
    htmlExporter.setConfiguration(reportExportConfiguration);
  }
  htmlExporter.setExporterInput(exporterInput);
  htmlExporter.setExporterOutput(exporterOutput);
  htmlExporter.exportReport();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:34,代码来源:ReportingUtils.java


示例2: html

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 *
 */
public void html() throws JRException
{
	long start = System.currentTimeMillis();
	List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
	
	HtmlExporter exporter = new HtmlExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleHtmlExporterOutput("build/reports/BatchExportReport.html"));
	
	exporter.exportReport();
	
	System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:BatchExportApp.java


示例3: saveHTMLReportToOutputStream

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 * Generates an HTML report from a pre-compiled report and returns it into an output stream.
 * 
 * @param jasperPrint
 *          JasperPrint object which contains a compiled report.
 * @param exportParameters
 *          Export parameters than can be added to configure the resulting report.
 * @param outputStream
 *          The output stream used to return the report.
 * @throws JRException
 *           In case there is any error generating the report an exception is thrown with the
 *           error message.
 */
private static void saveHTMLReportToOutputStream(JasperPrint jasperPrint,
    Map<Object, Object> exportParameters, OutputStream outputStream) throws JRException {
  final HtmlExporter htmlExporter = new HtmlExporter();
  SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
  SimpleHtmlExporterOutput exporterOutput = new SimpleHtmlExporterOutput(outputStream);

  if (exportParameters != null && exportParameters.size() > 0) {
    SimpleHtmlReportConfiguration exportConfiguration = new SimpleHtmlReportConfiguration();
    setHtmlConfigurationFromExportParameters(exportParameters, exportConfiguration,
        exporterOutput);
    htmlExporter.setConfiguration(exportConfiguration);
  } else {
    SimpleHtmlReportConfiguration reportExportConfiguration = new SimpleHtmlReportConfiguration();
    reportExportConfiguration.setSizeUnit(HtmlSizeUnitEnum.POINT);
    htmlExporter.setConfiguration(reportExportConfiguration);
  }
  htmlExporter.setExporterInput(exporterInput);
  htmlExporter.setExporterOutput(exporterOutput);
  try {
    htmlExporter.exportReport();
  } catch (Exception e) {
    // Handle the exception to ignore the error thrown when the user closes the browser before
    // getting the whole HTML report
    Throwable t = e.getCause();
    if (t != null && !(t.toString().contains("ClientAbortException"))) {
      throw new JRException(e.getMessage(), e);
    }
  }
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:43,代码来源:ReportingUtils.java


示例4: html

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 *
 */
public void html() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/NoPageBreakReport.jrprint");

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

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html");
	
	HtmlExporter exporter = new HtmlExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleHtmlExporterOutput(destFile));
	
	SimpleHtmlExporterConfiguration exporterConfig = new SimpleHtmlExporterConfiguration();
	exporterConfig.setBetweenPagesHtml("");
	exporter.setConfiguration(exporterConfig);

	SimpleHtmlReportConfiguration reportConfig = new SimpleHtmlReportConfiguration();
	reportConfig.setRemoveEmptySpaceBetweenRows(true);
	exporter.setConfiguration(reportConfig);
	
	exporter.exportReport();

	System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:30,代码来源:NoPageBreakApp.java


示例5: save

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public void save(JasperPrint jasperPrint, File file) throws JRException
{
	if (
		!file.getName().toLowerCase().endsWith(EXTENSION_HTM)
		&& !file.getName().toLowerCase().endsWith(EXTENSION_HTML)
		)
	{
		file = new File(file.getAbsolutePath() + EXTENSION_HTML);
	}
		
	if (
		!file.exists() ||
		JOptionPane.OK_OPTION == 
			JOptionPane.showConfirmDialog(
				null, 
				MessageFormat.format(
					getBundleString("file.exists"),
					new Object[]{file.getName()}
					), 
				getBundleString("save"), 
				JOptionPane.OK_CANCEL_OPTION
				)
		)
	{
		HtmlExporter exporter = new HtmlExporter(getJasperReportsContext());
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); 
		exporter.setExporterOutput(new SimpleHtmlExporterOutput(file));
		exporter.exportReport(); 
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:32,代码来源:JRHtmlSaveContributor.java


示例6: exportToHtmlFile

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 * Exports the generated report object received as parameter into HTML format,
 * placing the result into the second file parameter.
 * <p>
 * The images are placed as distinct files inside a directory having the same name 
 * as the HTML destination file, plus the "_files" suffix. 
 * 
 * @param jasperPrint  report object to export
 * @param destFileName file name to place the HTML content into
 * @see net.sf.jasperreports.engine.export.JRPdfExporter
 */
public void exportToHtmlFile(
	JasperPrint jasperPrint, 
	String destFileName
	) throws JRException
{
	HtmlExporter exporter = new HtmlExporter(jasperReportsContext);
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleHtmlExporterOutput(destFileName));
	
	exporter.exportReport();
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:JasperExportManager.java


示例7: createColumnGroupCell

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
protected JRElement createColumnGroupCell(ColumnGroup columnGroup, Cell cell, JRDesignElementGroup elementGroup)
{
	JRDesignFrame frame = (JRDesignFrame) createCell(elementGroup, cell, 
			columnGroup.getWidth(), fillColumn.getWidth(), 
			xOffset, yOffset, null, deriveUUID(), true);
	frame.getPropertiesMap().setProperty(HtmlExporter.PROPERTY_HTML_CLASS, "jrcolGroupHeader");
	return frame;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:10,代码来源:TableReport.java


示例8: exportXhtml

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
public void exportXhtml() throws JRException {
	HtmlExporter exporter = new HtmlExporter();
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleHtmlExporterOutput(this.output
			.getAbsolutePath() + ".x.html"));
	exporter.exportReport();
}
 
开发者ID:vosskaem,项目名称:jasperstarter,代码行数:8,代码来源:Report.java


示例9: getExporter

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
protected HtmlExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) {
	HtmlExporter exp = new HtmlExporter(jContext);
	exp.setExporterOutput(new SimpleHtmlExporterOutput(file));

	SimpleHtmlReportConfiguration rconf = new SimpleHtmlReportConfiguration();
	setupReportConfiguration(rconf, monitor);
	exp.setConfiguration(rconf);
	return exp;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:ExportAsLHtmlAction.java


示例10: export

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的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.");
    }
}
 
开发者ID:seedstack,项目名称:io-addon,代码行数:43,代码来源:JasperRenderer.java


示例11: getHandler

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public GenericElementHandler getHandler(String elementName, String exporterKey) {
	if (handlers.containsKey(elementName)) {
		if (HtmlExporter.HTML_EXPORTER_KEY.equals(exporterKey)) {
			return handlers.get(elementName);
		}
	}
	return null;
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:10,代码来源:GoogleChartsHandler.java


示例12: service

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public void service(
	HttpServletRequest request,
	HttpServletResponse response
	) throws IOException, ServletException
{
	ServletContext context = this.getServletConfig().getServletContext();

	response.setContentType("text/html");
	PrintWriter out = response.getWriter();

	try
	{
		File reportFile = new File(context.getRealPath("/reports/WebappReport.jasper"));
		if (!reportFile.exists())
			throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");

		JasperReport jasperReport = (JasperReport)JRLoader.loadObjectFromFile(reportFile.getPath());
	
		Map<String, Object> parameters = new HashMap<String, Object>();
		parameters.put("ReportTitle", "Address Report");
		parameters.put("BaseDir", reportFile.getParentFile());
					
		JasperPrint jasperPrint = 
			JasperFillManager.fillReport(
				jasperReport, 
				parameters, 
				new WebappDataSource()
				);
					
		HtmlExporter exporter = new HtmlExporter();
	
		request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
		
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		SimpleHtmlExporterOutput output = new SimpleHtmlExporterOutput(out);
		output.setImageHandler(new WebHtmlResourceHandler("image?image={0}"));
		exporter.setExporterOutput(output);
		
		exporter.exportReport();
	}
	catch (JRException e)
	{
		out.println("<html>");
		out.println("<head>");
		out.println("<title>JasperReports - Web Application Sample</title>");
		out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
		out.println("</head>");
		
		out.println("<body bgcolor=\"white\">");

		out.println("<span class=\"bnew\">JasperReports encountered this error :</span>");
		out.println("<pre>");

		e.printStackTrace(out);

		out.println("</pre>");

		out.println("</body>");
		out.println("</html>");
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:63,代码来源:HtmlServlet.java


示例13: html

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 *
 */
public void html() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/StylesReport.jrprint");

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

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

	HtmlExporter exporter = new HtmlExporter();

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

	exporter.exportReport();

	System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:StylesApp.java


示例14: getHandler

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public GenericElementHandler getHandler(String elementName,
		String exporterKey)
{
	if (NAME.equals(elementName)
			&& JRPdfExporter.PDF_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementPdfHandler();
	}
	else if (NAME.equals(elementName)
			&& HtmlExporter.HTML_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementHtmlHandler();
	}
	else if (NAME.equals(elementName)
			&& JRXlsExporter.XLS_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementXlsHandler();
	}
	else if (NAME.equals(elementName)
			&& JRGraphics2DExporter.GRAPHICS2D_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementGraphics2DHandler();
	}		
	else if (NAME.equals(elementName)
			&& JRDocxExporter.DOCX_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementDocxHandler();
	}		
	else if (NAME.equals(elementName)
			&& JRPptxExporter.PPTX_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementPptxHandler();
	}
	else if (NAME.equals(elementName)
			&& JRXlsxExporter.XLSX_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementXlsxHandler();
	}
	else if (NAME.equals(elementName)
			&& JRRtfExporter.RTF_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementRtfHandler();
	}
	else if (NAME.equals(elementName)
			&& JROdtExporter.ODT_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementOdtHandler();
	}
	else if (NAME.equals(elementName)
			&& JROdsExporter.ODS_EXPORTER_KEY.equals(exporterKey))
	{
		return new HtmlElementOdsHandler();
	}		
	return null;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:57,代码来源:HtmlElementHandlerBundle.java


示例15: addHtmlClass

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
protected void addHtmlClass(String className)
{
	String originalClasses = printProperties.get(HtmlExporter.PROPERTY_HTML_CLASS);
	String newClasses = originalClasses == null ? className : (originalClasses + " " + className);
	setPrintProperty(HtmlExporter.PROPERTY_HTML_CLASS, newClasses);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:7,代码来源:JRFillCellContents.java


示例16: getHtmlFragment

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public String getHtmlFragment(JRHtmlExporterContext context, JRGenericPrintElement element)
{
       ReportContext reportContext = context.getExporterRef().getReportContext();
	Map<String, Object> contextMap = new HashMap<String, Object>();

       contextMap.put("mapCanvasId", "map_canvas_" + element.hashCode());

       HtmlExporter htmlExporter = (HtmlExporter)context.getExporterRef();

       contextMap.put("elementX", htmlExporter.toSizeUnit((float)element.getX()));
       contextMap.put("elementY", htmlExporter.toSizeUnit((float)element.getY()));
       contextMap.put("elementWidth", element.getWidth());
       contextMap.put("elementHeight", element.getHeight());

       if (element.getModeValue() == ModeEnum.OPAQUE)
       {
           contextMap.put("backgroundColor", JRColorUtil.getColorHexa(element.getBackcolor()));
       }

       contextMap.put("gotReportContext", reportContext != null);

       if (reportContext == null)
       {
           Float latitude = (Float)element.getParameterValue(MapComponent.ITEM_PROPERTY_latitude);
           latitude = latitude == null ? MapComponent.DEFAULT_LATITUDE : latitude;

           Float longitude = (Float)element.getParameterValue(MapComponent.ITEM_PROPERTY_longitude);
           longitude = longitude == null ? MapComponent.DEFAULT_LONGITUDE : longitude;

           Integer zoom = (Integer)element.getParameterValue(MapComponent.PARAMETER_ZOOM);
           zoom = zoom == null ? MapComponent.DEFAULT_ZOOM : zoom;

           String mapType = (String)element.getParameterValue(MapComponent.ATTRIBUTE_MAP_TYPE);
           mapType = (mapType == null ? MapComponent.DEFAULT_MAP_TYPE.getName() : mapType).toUpperCase();

           contextMap.put("latitude", latitude);
           contextMap.put("longitude", longitude);
           contextMap.put("zoom", zoom);
           contextMap.put("mapType", mapType);

           List<Map<String,Object>> markerList = (List<Map<String,Object>>)element.getParameterValue(MapComponent.PARAMETER_MARKERS);
           String markers = markerList == null || markerList.isEmpty() ? "[]" : JacksonUtil.getInstance(context.getJasperReportsContext()).getJsonString(markerList);
           contextMap.put("markerList", markers);

           List<Map<String,Object>> pathList = (List<Map<String,Object>>)element.getParameterValue(MapComponent.PARAMETER_PATHS);
           String paths = pathList == null || pathList.isEmpty() ? "[]" : JacksonUtil.getInstance(context.getJasperReportsContext()).getJsonString(pathList);
           contextMap.put("pathsList", paths);

           String reqParams = (String)element.getParameterValue(MapComponent.PARAMETER_REQ_PARAMS);
           if(reqParams != null)
           {
               contextMap.put(MapComponent.PARAMETER_REQ_PARAMS, reqParams);
           }

           if (context.getValue(FIRST_ATTEMPT_PARAM) == null)
           {
               context.setValue(FIRST_ATTEMPT_PARAM, true);

               //FIXME: support for parametrized http://maps.google.com/maps/api/js script (see MapElementHtmlTemplate.vm)
               contextMap.put("exporterFirstAttempt", true);
           }
       }
	
	return VelocityUtil.processTemplate(MAP_ELEMENT_HTML_TEMPLATE, contextMap);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:67,代码来源:MapElementHtmlHandler.java


示例17: getHtmlFragment

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public String getHtmlFragment(JRHtmlExporterContext context, JRGenericPrintElement element)
{
	JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT);
	if (labelPrintText == null)
	{
		return null;
	}

	JRBasePrintFrame frame = new JRBasePrintFrame(element.getDefaultStyleProvider());
	frame.setX(element.getX());
	frame.setY(element.getY());
	frame.setWidth(element.getWidth());
	frame.setHeight(element.getHeight());
	frame.setStyle(element.getStyle());
	frame.setBackcolor(element.getBackcolor());
	frame.setForecolor(element.getForecolor());
	frame.setMode(element.getModeValue());
	JRLineBox lineBox = (JRLineBox)element.getParameterValue(IconLabelElement.PARAMETER_LINE_BOX);
	if (lineBox != null)
	{
		frame.copyBox(lineBox);
	}
	
	frame.addElement(labelPrintText);
	
	JRPrintText iconPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_ICON_TEXT_ELEMENT);
	if (iconPrintText != null)
	{
		frame.addElement(iconPrintText);
	}

	HtmlExporter htmlExporter = (HtmlExporter)context.getExporterRef();
	List<JRPrintElement> elements = new ArrayList<JRPrintElement>();
	elements.add(frame);

	try
	{
		htmlExporter.exportElements(elements);
	}
	catch (IOException e)
	{
		throw new JRRuntimeException(e);
	}
	
	return "";
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:48,代码来源:IconLabelElementHtmlHandler.java


示例18: getHtmlFragment

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
@Override
public String getHtmlFragment(JRHtmlExporterContext context, JRGenericPrintElement element)	{
	Boolean showLegend = (Boolean) element.getParameterValue(GeoMapPrintElement.PARAMETER_SHOW_LEGEND);
	GeoMapDataMode dataMode = (GeoMapDataMode) element.getParameterValue(GeoMapPrintElement.PARAMETER_DATA_MODE);
	String region = (String) element.getParameterValue(GeoMapPrintElement.PARAMETER_REGION);
	String valueLabel = (String) element.getParameterValue(GeoMapPrintElement.PARAMETER_VALUE_LABEL);
	if (valueLabel == null) {
		valueLabel = "";
	}
	@SuppressWarnings("unchecked")
	List<Color> colors = (List<Color>) element.getParameterValue(GeoMapPrintElement.PARAMETER_COLORS);
	String stringColors = null;
	if (colors != null && !colors.isEmpty()) {
		stringColors = "";
		for (Color color : colors) {
			stringColors += "," + getColorString(color);
		}
		stringColors = StringUtils.removeStart(stringColors, ",");
	}
	@SuppressWarnings("unchecked")
	Set<GeoMapData> dataset = (Set<GeoMapData>) element.getParameterValue(GeoMapPrintElement.PARAMETER_DATASET);

	VelocityContext velocityContext = new VelocityContext();
	velocityContext.put("showLegend", showLegend);
	if (dataMode != null) {
		switch (dataMode) {
		case REGIONS:
			velocityContext.put("dataMode", "regions");
			break;
		case MARKERS:
			velocityContext.put("dataMode", "markers");
			break;
		default:
			break;
		}
	}
	velocityContext.put("id", "map_" + element.hashCode());
	velocityContext.put("region", region);
	velocityContext.put("valueLabel", valueLabel);
	velocityContext.put("colors", stringColors);
	velocityContext.put("dataset", dataset);
   @SuppressWarnings("unchecked")
	Exporter<ExporterInput, ? extends HtmlReportConfiguration, ? extends HtmlExporterConfiguration, HtmlExporterOutput> exporter = context.getExporterRef();
   HtmlExporter htmlExporter2 = exporter instanceof HtmlExporter ? (HtmlExporter)exporter : null;
	if(htmlExporter2 == null) {
		velocityContext.put("xhtml", "xhtml");
		velocityContext.put("elementX", ((HtmlExporter)context.getExporterRef()).toSizeUnit((float) element.getX()));
		velocityContext.put("elementY", ((HtmlExporter)context.getExporterRef()).toSizeUnit((float) element.getY()));
	}
	else {
		velocityContext.put("elementX", ((HtmlExporter)context.getExporterRef()).toSizeUnit((float) element.getX()));
		velocityContext.put("elementY", ((HtmlExporter)context.getExporterRef()).toSizeUnit((float) element.getY()));
	}
	velocityContext.put("elementWidth", element.getWidth());
	velocityContext.put("elementHeight", element.getHeight());

	if (element.getModeValue() == ModeEnum.OPAQUE) {
		velocityContext.put("backgroundColor", JRColorUtil.getColorHexa(element.getBackcolor()));
	}
	return VelocityUtil.processTemplate(GEOMAP_ELEMENT_HTML_TEMPLATE, velocityContext);
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:62,代码来源:GeoMapElementHtmlHandler.java


示例19: saveHTMLReport

import net.sf.jasperreports.engine.export.HtmlExporter; //导入依赖的package包/类
/**
 * Generates an HTML report using the SimpleExporterInput, SimpleHtmlExporterOutput and
 * SimpleHtmlReportConfiguration received as parameters.
 * 
 * @param exporterInput
 *          SimpleExporterInput object with the input data.
 * @param exporterOutput
 *          SimpleHtmlExporterOutput object with the output data.
 * @param exportConfiguration
 *          SimpleHtmlReportConfiguration with the configuration data.
 * @throws JRException
 *           In case there is any error generating the report an exception is thrown with the
 *           error message.
 */
public static void saveHTMLReport(SimpleExporterInput exporterInput,
    SimpleHtmlExporterOutput exporterOutput, SimpleHtmlReportConfiguration exportConfiguration)
    throws JRException {
  final HtmlExporter htmlExporter = new HtmlExporter();
  htmlExporter.setExporterInput(exporterInput);
  htmlExporter.setExporterOutput(exporterOutput);
  htmlExporter.setConfiguration(exportConfiguration);
  htmlExporter.exportReport();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:24,代码来源:ReportingUtils.java



注:本文中的net.sf.jasperreports.engine.export.HtmlExporter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiLineLabelUI类代码示例发布时间:2022-05-22
下一篇:
Java BlockStmt类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap