0
 String outputFile = "users.csv";
 outputFile = new String(outputFile.getBytes("Windows-31J"), "ISO8859_1");
 response().setContentType("application/octet-stream;charset=Windows-31J");
 response().setHeader("Content-Disposition", "attachment; 
 filename=\"" + outputFile + "\"");

i also write in my code like that. but, output (CSV excel) come with the data of HTML code. example; so. if you have CSV export sample source code.,plz can you share me ?? (I am from Myanmar.)

4

1 回答 1

0

这样的事情可能会让你开始。寻找 JavaCSV (http://sourceforge.net/projects/javacsv/)

ByteArrayOutputStream stream = new ByteArrayOutputStream();
CsvWriter csv = new CsvWriter(stream, ',', Charset.forName(UTF8));
// add records
csv.close();
return ok(new ByteArrayInputStream(stream.toByteArray()));
于 2012-11-14T06:26:42.280 回答