本文整理汇总了Java中com.Ostermiller.util.ExcelCSVPrinter类的典型用法代码示例。如果您正苦于以下问题:Java ExcelCSVPrinter类的具体用法?Java ExcelCSVPrinter怎么用?Java ExcelCSVPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExcelCSVPrinter类属于com.Ostermiller.util包,在下文中一共展示了ExcelCSVPrinter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: export
import com.Ostermiller.util.ExcelCSVPrinter; //导入依赖的package包/类
public ActionForward export(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException {
checkPrivilege(request, PRIVILEGE_READ);
List<DxAssociation> associations = dxDao.findAllAssociations();
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=\"dx_associations.csv\"");
ExcelCSVPrinter printer = new ExcelCSVPrinter(response.getWriter());
printer.writeln(new String[] { "Issue List Code Type", "Issue List Code", "Disease Registry Code Type", "Disease Registry Code" });
for (DxAssociation dxa : associations) {
printer.writeln(new String[] { dxa.getCodeType(), dxa.getCode(), dxa.getDxCodeType(), dxa.getDxCode() });
}
printer.flush();
printer.close();
return null;
}
示例2: export
import com.Ostermiller.util.ExcelCSVPrinter; //导入依赖的package包/类
public ActionForward export(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException
{
List<DxAssociation> associations = dxDao.findAllAssociations();
response.setContentType("application/octet-stream" );
response.setHeader( "Content-Disposition", "attachment; filename=\"dx_associations.csv\"" );
ExcelCSVPrinter printer = new ExcelCSVPrinter(response.getWriter());
printer.writeln(new String[] {"Issue List Code Type","Issue List Code","Disease Registry Code Type","Disease Registry Code"});
for(DxAssociation dxa:associations) {
printer.writeln(new String[] {dxa.getCodeType(),dxa.getCode(),dxa.getDxCodeType(),dxa.getDxCode()});
}
printer.flush();
printer.close();
return null;
}
示例3: Logger
import com.Ostermiller.util.ExcelCSVPrinter; //导入依赖的package包/类
/**
* Logging facility
*/
public Logger(String[] columnHeaders) {
try {
// init ensures that keys in LinkedHashMap always have same order
currentLog = new LinkedHashMap<String, String>();
for (String column : columnHeaders) {
currentLog.put(column, noDataSymbol); // per default has no value
}
// store the number of columns for validation when logging data
columnCount = columnHeaders.length;
// create directory for logs
File dir = new File(logFileDir);
if (!dir.exists()) {
dir.mkdir();
}
// define log file
File logFile = new File(this.logFilePath + "_" + Logger.currentTime() + ".log");
// Create the log CSV printer pointed at log file
// Logging file can only be created at this point
logPrinter = new ExcelCSVPrinter(new FileOutputStream(logFile));
// always write results immediately
logPrinter.setAutoFlush(true);
// header
logPrinter.writeln(columnHeaders);
} catch (Exception e) {
System.out.println("Logger: Logger() Could'nt write log status - Exception.");
}
}