|
|
@ -20,6 +20,8 @@ import org.apache.poi.hssf.usermodel.HSSFCell; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.CellStyle; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
|
@ -71,10 +73,14 @@ public class ExcelUtils { |
|
|
|
//set the height of the first line
|
|
|
|
//set the height of the first line
|
|
|
|
row.setHeight((short)500); |
|
|
|
row.setHeight((short)500); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//set Horizontal right
|
|
|
|
|
|
|
|
CellStyle cellStyle = wb.createCellStyle(); |
|
|
|
|
|
|
|
cellStyle.setAlignment(HorizontalAlignment.RIGHT); |
|
|
|
|
|
|
|
|
|
|
|
//setting excel headers
|
|
|
|
//setting excel headers
|
|
|
|
for (int i = 0; i < headerList.size(); i++) { |
|
|
|
for (int i = 0; i < headerList.size(); i++) { |
|
|
|
HSSFCell cell = row.createCell(i); |
|
|
|
HSSFCell cell = row.createCell(i); |
|
|
|
|
|
|
|
cell.setCellStyle(cellStyle); |
|
|
|
cell.setCellValue(headerList.get(i)); |
|
|
|
cell.setCellValue(headerList.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -88,6 +94,7 @@ public class ExcelUtils { |
|
|
|
rowIndex++; |
|
|
|
rowIndex++; |
|
|
|
for (int j = 0 ; j < values.length ; j++){ |
|
|
|
for (int j = 0 ; j < values.length ; j++){ |
|
|
|
HSSFCell cell1 = row.createCell(j); |
|
|
|
HSSFCell cell1 = row.createCell(j); |
|
|
|
|
|
|
|
cell1.setCellStyle(cellStyle); |
|
|
|
cell1.setCellValue(String.valueOf(values[j])); |
|
|
|
cell1.setCellValue(String.valueOf(values[j])); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|