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

Java JRCsvExporterParameter类代码示例

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

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



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

示例1: exportToCSV

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
private void exportToCSV(String delim) {
    log.debug("exporting to CSV. Delimiter char '" + delim + "'");
    csvExporter = new JRCsvExporter();
    setExportParameter(JRCsvExporterParameter.FIELD_DELIMITER, delim);
    setExportParameter(JRCsvExporterParameter.RECORD_DELIMITER, "\r\n");
    csvExporter.setParameters(getExportParameters());
    try {
        start = System.currentTimeMillis();
        csvExporter.exportReport();
        log.info("export running time (msec): "
                + (System.currentTimeMillis() - start));
    } catch (JRException jre) {
        jre.printStackTrace();
        log.error(jre.getCause());
    }
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:17,代码来源:OOReportGenerator.java


示例2: renderAsCsvWithExporterParameters

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
@Test
public void renderAsCsvWithExporterParameters() throws Exception {
	StringWriter writer = new StringWriter();
	Map<JRExporterParameter, Object> exporterParameters = new HashMap<JRExporterParameter, Object>();
	exporterParameters.put(JRCsvExporterParameter.FIELD_DELIMITER, "~");
	JasperReportsUtils.renderAsCsv(getReport(), getParameters(), getData(), writer, exporterParameters);
	String output = writer.getBuffer().toString();
	assertCsvOutputCorrect(output);
	assertTrue("Delimiter is incorrect", output.contains("~"));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JasperReportsUtilsTests.java


示例3: jButtonResetActionPerformed

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
private void jButtonResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetActionPerformed

        JRPropertiesUtil jrPropUtils = IRLocalJasperReportsContext.getUtilities();
        JasperReportsContext context = IRLocalJasperReportsContext.getInstance();
        
        jTextField1.setText( Misc.addSlashesString(jrPropUtils.getProperty(JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER)) );
        jTextField2.setText( Misc.addSlashesString(jrPropUtils.getProperty(JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER)) );
        notifyChange();
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:10,代码来源:CSVExportParametersPanel.java


示例4: configureCsvExporter

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
private void configureCsvExporter(JRExporter exporter, SimpleJasperReportsContext context) {

        Preferences pref = IReportManager.getPreferences();
        JRPropertiesUtil jrPropUtils = JRPropertiesUtil.getInstance(context);

        context.setValue( JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER, pref.get(JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER, jrPropUtils.getProperty(JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER)));
        context.setValue( JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER, pref.get(JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER, jrPropUtils.getProperty(JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER)));
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:9,代码来源:DefaultExporterFactory.java


示例5: testRenderAsCsvWithExporterParameters

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
public void testRenderAsCsvWithExporterParameters() throws Exception {
	StringWriter writer = new StringWriter();
	Map<JRExporterParameter, Object> exporterParameters = new HashMap<JRExporterParameter, Object>();
	exporterParameters.put(JRCsvExporterParameter.FIELD_DELIMITER, "~");
	JasperReportsUtils.renderAsCsv(getReport(), getParameters(), getData(), writer, exporterParameters);
	String output = writer.getBuffer().toString();
	assertCsvOutputCorrect(output);
	assertTrue("Delimiter is incorrect", output.contains("~"));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:10,代码来源:JasperReportsUtilsTests.java


示例6: export

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
/**
 * Processes the download for Excel format
 *
 * @param response
 * @param resourceId
 * @param auditStatistics
 * @param dataSource
 * @param locale
 * @param format
 * @throws ColumnBuilderException
 * @throws ClassNotFoundException
 * @throws JRException
 * @throws NotSupportedExportFormatException
 */
@SuppressWarnings("unchecked")
public void export(
        HttpServletResponse response,
        long resourceId,
        AuditStatistics auditStatistics,
        Collection<?> dataSource,
        Locale locale,
        String format)
        throws ColumnBuilderException, ClassNotFoundException, JRException, NotSupportedExportFormatException {

    if (!exportFormatMap.containsKey(format)) {
        throw new NotSupportedExportFormatException(format);
    }
    ExportFormat exportFormat = exportFormatMap.get(format);

    DynamicReport dr = LayoutFactory.getInstance().buildReportLayout(locale, auditStatistics, format);
    // Retrieve our data source
    JRDataSource ds = new JRBeanCollectionDataSource(dataSource);

    // params is used for passing extra parameters
    JasperPrint jp
            = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), ds);

    // Create our output byte stream
    // This is the stream where the data will be written
    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    JRExporter exporter = null;
    try {
        exporter = (JRExporter) Class.forName(exportFormat.getExporterClassName()).newInstance();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
        if (exportFormat.getFileType().equals("text/csv")) {
            exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, GENERAL_SEPARATOR_KEY);
        }
        exporter.exportReport();
        response.setHeader(CONTENT_DISPOSITION, INLINE_FILENAME
                + getFileName(resourceId, exportFormat.getFileExtension()));
        // Make sure to set the correct content type
        // Each format has its own content type
        response.setContentType(exportFormat.getFileType());
        response.setContentLength(baos.size());
        // Write to reponse stream
        writeReportToResponseStream(response, baos);
    } catch (InstantiationException | IllegalAccessException ex) {
        LOGGER.warn(ex);
    }

}
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:64,代码来源:ExportService.java


示例7: load

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
public void load() {

        setInit(true);
        Preferences pref = IReportManager.getPreferences();
        
        JRPropertiesUtil jrPropUtils = IRLocalJasperReportsContext.getUtilities();
        
        jTextField1.setText( Misc.addSlashesString(pref.get(JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER, jrPropUtils.getProperty(JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER))));
        jTextField2.setText( Misc.addSlashesString(pref.get(JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER, jrPropUtils.getProperty(JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER))));
        
        setInit(false);
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:13,代码来源:CSVExportParametersPanel.java


示例8: store

import net.sf.jasperreports.engine.export.JRCsvExporterParameter; //导入依赖的package包/类
public void store() {
    Preferences pref = IReportManager.getPreferences();

    pref.put(JRCsvExporterParameter.PROPERTY_FIELD_DELIMITER, Misc.removeSlashesString( jTextField1.getText()) );
    pref.put(JRCsvExporterParameter.PROPERTY_RECORD_DELIMITER, Misc.removeSlashesString( jTextField2.getText()) );

}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:8,代码来源:CSVExportParametersPanel.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java OSProcess类代码示例发布时间:2022-05-22
下一篇:
Java VectorialCovariance类代码示例发布时间: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