本文整理匯總了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.");
}
}