生成csv格式时,我会得到前十二个空白行,并且数据从第13行开始追加。请帮助如何忽略csv报告中的前十二个空行,数据应从第一行开始。以下是我的示例代码。
if(excelParam.equals("csv")){
ServletOutputStream stream = response.getOutputStream();
StringBuffer stoppedTxnRowSB = new StringBuffer();
response.setContentType("application/vnd.ms-excel; charset=UTF-8");
response.setHeader("Content-Disposition","attachment; filename=\"sample.csv\"");
response.addHeader("Content-description", reportTitle);
for(int i=0; i < reportHeader.length; i++){
if(i == (samHead.length -1)){
row.append(samHead[i] + "\n");
}
else{
row.append(samHead[i]+", ");
}
}
stream.print(stoppedTxnRowSB.toString());
stream.flush();
return;