本文整理汇总了Java中net.sf.jasperreports.engine.data.JRCsvDataSource.setRecordDelimiter方法的典型用法代码示例。如果您正苦于以下问题:Java JRCsvDataSource.setRecordDelimiter方法的具体用法?Java JRCsvDataSource.setRecordDelimiter怎么用?Java JRCsvDataSource.setRecordDelimiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.data.JRCsvDataSource
的用法示例。
在下文中一共展示了JRCsvDataSource.setRecordDelimiter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fill
import net.sf.jasperreports.engine.data.JRCsvDataSource; //导入方法依赖的package包/类
/**
*
*/
public void fill() throws JRException
{
long start = System.currentTimeMillis();
Map<String, Object> parameters = new HashMap<String, Object>();
try
{
JRCsvDataSource xyds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/xyDatasource.csv"), "UTF-8");
xyds.setRecordDelimiter("\r\n");
xyds.setUseFirstRowAsHeader(true);
parameters.put("xyDatasource", xyds);
}
catch (Exception e)
{
throw new JRException(e);
}
JasperFillManager.fillReportToFile("build/reports/XYChart.jasper", new HashMap<String, Object>(parameters), new JREmptyDataSource());
System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
示例2: getJRDataSource
import net.sf.jasperreports.engine.data.JRCsvDataSource; //导入方法依赖的package包/类
/**
* This method return an instanced JRDataDource to the database.
* If isJDBCConnection() return true => getJRDataSource() return false
*/
@Override
public net.sf.jasperreports.engine.JRDataSource getJRDataSource() {
try {
JRCsvDataSource ds = new JRCsvDataSource(new File(getFilename()));
if (this.getCustomDateFormat() != null && this.getCustomDateFormat().length() > 0)
{
ds.setDateFormat(new SimpleDateFormat(this.getCustomDateFormat()));
}
ds.setFieldDelimiter( getFieldDelimiter().charAt(0) );
ds.setRecordDelimiter( getRecordDelimiter());
ds.setUseFirstRowAsHeader( isUseFirstRowAsHeader());
if (!isUseFirstRowAsHeader())
{
String[] names = new String[getColumnNames().size()];
for (int i=0; i<names.length; ++i )
{
names[i] = ""+getColumnNames().elementAt(i);
}
ds.setColumnNames( names );
}
return ds;
} catch (Exception ex)
{
ex.printStackTrace();
return super.getJRDataSource();
}
}
示例3: getDataSource
import net.sf.jasperreports.engine.data.JRCsvDataSource; //导入方法依赖的package包/类
private static JRCsvDataSource getDataSource() throws JRException, IOException {
//JRLoader.getLocationInputStream(
JRCsvDataSource ds = new JRCsvDataSource(new File("C:\\wsfirext\\Firext_local\\WebContent\\WEB-INF\\reports\\test.csv"));
ds.setRecordDelimiter("\t");
ds.setUseFirstRowAsHeader(true);
ds.setFieldDelimiter(';');
return ds;
}