- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 apache POI 从数据库读取数据并渲染到 Excel。我用的是Oracle数据库。我在 Excel 中的预期输出是 desired output
excel中的实际输出是actual output
其中员工的名字是 Devendra Singh 和 Yuvraj Verma。下面是它们各自的 token 编号:A1359 和 A1539。 R、W、FH、OTR、OTW、OTFH 是每个员工的生产值。
使用 System.out.print 时,代码显示正确的位置,但不在 Excel 工作表中。也不异常(exception)。
//method to create cells
private static void createCell(XSSFWorkbook wb, XSSFRow row, short column, short halign, short valign,Object value) {
System.out.println("Creating row #"+row.getRowNum() + " Colm# "+column+" value "+value);
XSSFCell cell = row.createCell(column);
cell.setCellValue(value.toString());
CellStyle cellStyle = wb.createCellStyle();
if(column == 1) {
XSSFDataFormat df = wb.createDataFormat();
cellStyle.setDataFormat(df.getFormat("d mmm yy"));
}
cellStyle.setAlignment(halign);
cellStyle.setVerticalAlignment(valign);
cell.setCellStyle(cellStyle);
}
在 System.out.println() 中获取输出为
name DEVENDRA SINGH token:A1359 category:D depart:14 month:11 year:2015
Creating row #1 Colm# 2 value DEVENDRA SINGH
Creating row #2 Colm# 2 value A1359
Creating row #3 Colm# 2 value R
Creating row #3 Colm# 3 value W
Creating row #3 Colm# 4 value FH
Creating row #3 Colm# 5 value OT-R
Creating row #3 Colm# 6 value OT-W
Creating row #3 Colm# 7 value OT-FH
Creating row #4 Colm# 1 value 01/Nov/2015
Creating row #4 Colm# 2 value 12
Creating row #4 Colm# 3 value 3
Creating row #4 Colm# 4 value 4
Creating row #4 Colm# 5 value 5
Creating row #4 Colm# 6 value 6
Creating row #4 Colm# 7 value 7
Creating row #5 Colm# 1 value 02/Nov/2015
Creating row #5 Colm# 2 value 5
Creating row #5 Colm# 3 value 2
Creating row #5 Colm# 4 value 5
Creating row #5 Colm# 5 value 3
Creating row #5 Colm# 6 value 3
Creating row #5 Colm# 7 value 4
Creating row #6 Colm# 1 value 03/Nov/2015
Creating row #6 Colm# 2 value 0
Creating row #6 Colm# 3 value 0
Creating row #6 Colm# 4 value 0
Creating row #6 Colm# 5 value 0
Creating row #6 Colm# 6 value 0
Creating row #6 Colm# 7 value 0
Creating row #7 Colm# 1 value 04/Nov/2015
Creating row #7 Colm# 2 value 0
Creating row #7 Colm# 3 value 9
Creating row #7 Colm# 4 value 0
Creating row #7 Colm# 5 value 0
Creating row #7 Colm# 6 value 6
Creating row #7 Colm# 7 value 0
Creating row #8 Colm# 1 value 05/Nov/2015
Creating row #8 Colm# 2 value 3
Creating row #8 Colm# 3 value 0
Creating row #8 Colm# 4 value 0
Creating row #8 Colm# 5 value 0
Creating row #8 Colm# 6 value 6
Creating row #8 Colm# 7 value 0
Creating row #9 Colm# 1 value 06/Nov/2015
Creating row #9 Colm# 2 value 0
Creating row #9 Colm# 3 value 0
Creating row #9 Colm# 4 value 0
Creating row #9 Colm# 5 value 0
Creating row #9 Colm# 6 value 0
Creating row #9 Colm# 7 value 0
Creating row #10 Colm# 1 value 07/Nov/2015
Creating row #10 Colm# 2 value 0
Creating row #10 Colm# 3 value 0
Creating row #10 Colm# 4 value 0
Creating row #10 Colm# 5 value 0
Creating row #10 Colm# 6 value 0
Creating row #10 Colm# 7 value 0
Creating row #11 Colm# 1 value 08/Nov/2015
Creating row #11 Colm# 2 value 0
Creating row #11 Colm# 3 value 0
Creating row #11 Colm# 4 value 0
Creating row #11 Colm# 5 value 0
Creating row #11 Colm# 6 value 0
Creating row #11 Colm# 7 value 0
Creating row #12 Colm# 1 value 09/Nov/2015
Creating row #12 Colm# 2 value 0
Creating row #12 Colm# 3 value 0
Creating row #12 Colm# 4 value 0
Creating row #12 Colm# 5 value 0
Creating row #12 Colm# 6 value 0
Creating row #12 Colm# 7 value 0
Creating row #13 Colm# 1 value 10/Nov/2015
Creating row #13 Colm# 2 value 0
Creating row #13 Colm# 3 value 0
Creating row #13 Colm# 4 value 0
Creating row #13 Colm# 5 value 0
Creating row #13 Colm# 6 value 0
Creating row #13 Colm# 7 value 0
Creating row #14 Colm# 1 value 11/Nov/2015
Creating row #14 Colm# 2 value 0
Creating row #14 Colm# 3 value 0
Creating row #14 Colm# 4 value 0
Creating row #14 Colm# 5 value 0
Creating row #14 Colm# 6 value 0
Creating row #14 Colm# 7 value 0
Creating row #15 Colm# 1 value 12/Nov/2015
Creating row #15 Colm# 2 value 0
Creating row #15 Colm# 3 value 0
Creating row #15 Colm# 4 value 0
Creating row #15 Colm# 5 value 0
Creating row #15 Colm# 6 value 0
Creating row #15 Colm# 7 value 0
Creating row #16 Colm# 1 value 13/Nov/2015
Creating row #16 Colm# 2 value 0
Creating row #16 Colm# 3 value 0
Creating row #16 Colm# 4 value 0
Creating row #16 Colm# 5 value 0
Creating row #16 Colm# 6 value 0
Creating row #16 Colm# 7 value 0
Creating row #17 Colm# 1 value 14/Nov/2015
Creating row #17 Colm# 2 value 0
Creating row #17 Colm# 3 value 0
Creating row #17 Colm# 4 value 0
Creating row #17 Colm# 5 value 0
Creating row #17 Colm# 6 value 0
Creating row #17 Colm# 7 value 0
Creating row #18 Colm# 1 value 15/Nov/2015
Creating row #18 Colm# 2 value 0
Creating row #18 Colm# 3 value 0
Creating row #18 Colm# 4 value 0
Creating row #18 Colm# 5 value 0
Creating row #18 Colm# 6 value 0
Creating row #18 Colm# 7 value 0
Creating row #19 Colm# 1 value 16/Nov/2015
Creating row #19 Colm# 2 value 0
Creating row #19 Colm# 3 value 0
Creating row #19 Colm# 4 value 0
Creating row #19 Colm# 5 value 0
Creating row #19 Colm# 6 value 0
Creating row #19 Colm# 7 value 0
Creating row #20 Colm# 1 value 17/Nov/2015
Creating row #20 Colm# 2 value 0
Creating row #20 Colm# 3 value 0
Creating row #20 Colm# 4 value 0
Creating row #20 Colm# 5 value 0
Creating row #20 Colm# 6 value 0
Creating row #20 Colm# 7 value 0
Creating row #21 Colm# 1 value 18/Nov/2015
Creating row #21 Colm# 2 value 0
Creating row #21 Colm# 3 value 0
Creating row #21 Colm# 4 value 0
Creating row #21 Colm# 5 value 0
Creating row #21 Colm# 6 value 0
Creating row #21 Colm# 7 value 0
Creating row #22 Colm# 1 value 19/Nov/2015
Creating row #22 Colm# 2 value 0
Creating row #22 Colm# 3 value 0
Creating row #22 Colm# 4 value 0
Creating row #22 Colm# 5 value 0
Creating row #22 Colm# 6 value 0
Creating row #22 Colm# 7 value 0
Creating row #23 Colm# 1 value 20/Nov/2015
Creating row #23 Colm# 2 value 0
Creating row #23 Colm# 3 value 0
Creating row #23 Colm# 4 value 0
Creating row #23 Colm# 5 value 0
Creating row #23 Colm# 6 value 0
Creating row #23 Colm# 7 value 0
Creating row #24 Colm# 1 value 21/Nov/2015
Creating row #24 Colm# 2 value 0
Creating row #24 Colm# 3 value 0
Creating row #24 Colm# 4 value 0
Creating row #24 Colm# 5 value 0
Creating row #24 Colm# 6 value 0
Creating row #24 Colm# 7 value 0
Creating row #25 Colm# 1 value 22/Nov/2015
Creating row #25 Colm# 2 value 0
Creating row #25 Colm# 3 value 0
Creating row #25 Colm# 4 value 0
Creating row #25 Colm# 5 value 0
Creating row #25 Colm# 6 value 0
Creating row #25 Colm# 7 value 0
Creating row #26 Colm# 1 value 23/Nov/2015
Creating row #26 Colm# 2 value 0
Creating row #26 Colm# 3 value 0
Creating row #26 Colm# 4 value 0
Creating row #26 Colm# 5 value 0
Creating row #26 Colm# 6 value 0
Creating row #26 Colm# 7 value 0
Creating row #27 Colm# 1 value 24/Nov/2015
Creating row #27 Colm# 2 value 0
Creating row #27 Colm# 3 value 0
Creating row #27 Colm# 4 value 0
Creating row #27 Colm# 5 value 0
Creating row #27 Colm# 6 value 0
Creating row #27 Colm# 7 value 0
Creating row #28 Colm# 1 value 25/Nov/2015
Creating row #28 Colm# 2 value 0
Creating row #28 Colm# 3 value 0
Creating row #28 Colm# 4 value 0
Creating row #28 Colm# 5 value 0
Creating row #28 Colm# 6 value 0
Creating row #28 Colm# 7 value 0
Creating row #29 Colm# 1 value 26/Nov/2015
Creating row #29 Colm# 2 value 0
Creating row #29 Colm# 3 value 0
Creating row #29 Colm# 4 value 0
Creating row #29 Colm# 5 value 0
Creating row #29 Colm# 6 value 0
Creating row #29 Colm# 7 value 0
Creating row #30 Colm# 1 value 27/Nov/2015
Creating row #30 Colm# 2 value 0
Creating row #30 Colm# 3 value 0
Creating row #30 Colm# 4 value 0
Creating row #30 Colm# 5 value 0
Creating row #30 Colm# 6 value 0
Creating row #30 Colm# 7 value 0
Creating row #31 Colm# 1 value 28/Nov/2015
Creating row #31 Colm# 2 value 0
Creating row #31 Colm# 3 value 0
Creating row #31 Colm# 4 value 0
Creating row #31 Colm# 5 value 0
Creating row #31 Colm# 6 value 0
Creating row #31 Colm# 7 value 0
Creating row #32 Colm# 1 value 29/Nov/2015
Creating row #32 Colm# 2 value 0
Creating row #32 Colm# 3 value 0
Creating row #32 Colm# 4 value 0
Creating row #32 Colm# 5 value 0
Creating row #32 Colm# 6 value 0
Creating row #32 Colm# 7 value 0
Creating row #33 Colm# 1 value 30/Nov/2015
Creating row #33 Colm# 2 value 0
Creating row #33 Colm# 3 value 0
Creating row #33 Colm# 4 value 0
Creating row #33 Colm# 5 value 0
Creating row #33 Colm# 6 value 0
Creating row #33 Colm# 7 value 0
***end****
***start****
name YUVRAJ VERMA token:A1539 category:D depart:14 month:11 year:2015
Creating row #1 Colm# 8 value YUVRAJ VERMA
Creating row #2 Colm# 8 value A1539
Creating row #3 Colm# 8 value R
Creating row #3 Colm# 9 value W
Creating row #3 Colm# 10 value FH
Creating row #3 Colm# 11 value OT-R
Creating row #3 Colm# 12 value OT-W
Creating row #3 Colm# 13 value OT-FH
Creating row #4 Colm# 8 value 2
Creating row #4 Colm# 9 value 0
Creating row #4 Colm# 10 value 3
Creating row #4 Colm# 11 value 0
Creating row #4 Colm# 12 value 3
Creating row #4 Colm# 13 value 0
Creating row #5 Colm# 8 value 0
Creating row #5 Colm# 9 value 0
Creating row #5 Colm# 10 value 0
Creating row #5 Colm# 11 value 4
Creating row #5 Colm# 12 value 0
Creating row #5 Colm# 13 value 0
Creating row #6 Colm# 8 value 3
Creating row #6 Colm# 9 value 0
Creating row #6 Colm# 10 value 0
Creating row #6 Colm# 11 value 0
Creating row #6 Colm# 12 value 0
Creating row #6 Colm# 13 value 0
Creating row #7 Colm# 8 value 0
Creating row #7 Colm# 9 value 68
Creating row #7 Colm# 10 value 8
Creating row #7 Colm# 11 value 0
Creating row #7 Colm# 12 value 0
Creating row #7 Colm# 13 value 0
Creating row #8 Colm# 8 value 0
Creating row #8 Colm# 9 value 0
Creating row #8 Colm# 10 value 0
Creating row #8 Colm# 11 value 0
Creating row #8 Colm# 12 value 0
Creating row #8 Colm# 13 value 0
Creating row #9 Colm# 8 value 0
Creating row #9 Colm# 9 value 0
Creating row #9 Colm# 10 value 0
Creating row #9 Colm# 11 value 0
Creating row #9 Colm# 12 value 0
Creating row #9 Colm# 13 value 0
Creating row #10 Colm# 8 value 0
Creating row #10 Colm# 9 value 0
Creating row #10 Colm# 10 value 0
Creating row #10 Colm# 11 value 0
Creating row #10 Colm# 12 value 0
Creating row #10 Colm# 13 value 0
Creating row #11 Colm# 8 value 0
Creating row #11 Colm# 9 value 0
Creating row #11 Colm# 10 value 0
Creating row #11 Colm# 11 value 0
Creating row #11 Colm# 12 value 0
Creating row #11 Colm# 13 value 0
Creating row #12 Colm# 8 value 0
Creating row #12 Colm# 9 value 0
Creating row #12 Colm# 10 value 0
Creating row #12 Colm# 11 value 0
Creating row #12 Colm# 12 value 0
Creating row #12 Colm# 13 value 0
Creating row #13 Colm# 8 value 0
Creating row #13 Colm# 9 value 0
Creating row #13 Colm# 10 value 0
Creating row #13 Colm# 11 value 0
Creating row #13 Colm# 12 value 0
Creating row #13 Colm# 13 value 0
Creating row #14 Colm# 8 value 0
Creating row #14 Colm# 9 value 0
Creating row #14 Colm# 10 value 0
Creating row #14 Colm# 11 value 0
Creating row #14 Colm# 12 value 0
Creating row #14 Colm# 13 value 0
Creating row #15 Colm# 8 value 0
Creating row #15 Colm# 9 value 0
Creating row #15 Colm# 10 value 0
Creating row #15 Colm# 11 value 0
Creating row #15 Colm# 12 value 0
Creating row #15 Colm# 13 value 0
Creating row #16 Colm# 8 value 0
Creating row #16 Colm# 9 value 0
Creating row #16 Colm# 10 value 0
Creating row #16 Colm# 11 value 0
Creating row #16 Colm# 12 value 0
Creating row #16 Colm# 13 value 0
Creating row #17 Colm# 8 value 0
Creating row #17 Colm# 9 value 0
Creating row #17 Colm# 10 value 0
Creating row #17 Colm# 11 value 0
Creating row #17 Colm# 12 value 0
Creating row #17 Colm# 13 value 0
Creating row #18 Colm# 8 value 0
Creating row #18 Colm# 9 value 0
Creating row #18 Colm# 10 value 0
Creating row #18 Colm# 11 value 0
Creating row #18 Colm# 12 value 0
Creating row #18 Colm# 13 value 0
Creating row #19 Colm# 8 value 0
Creating row #19 Colm# 9 value 0
Creating row #19 Colm# 10 value 0
Creating row #19 Colm# 11 value 0
Creating row #19 Colm# 12 value 0
Creating row #19 Colm# 13 value 0
Creating row #20 Colm# 8 value 0
Creating row #20 Colm# 9 value 0
Creating row #20 Colm# 10 value 0
Creating row #20 Colm# 11 value 0
Creating row #20 Colm# 12 value 0
Creating row #20 Colm# 13 value 0
Creating row #21 Colm# 8 value 0
Creating row #21 Colm# 9 value 0
Creating row #21 Colm# 10 value 0
Creating row #21 Colm# 11 value 0
Creating row #21 Colm# 12 value 0
Creating row #21 Colm# 13 value 0
Creating row #22 Colm# 8 value 0
Creating row #22 Colm# 9 value 0
Creating row #22 Colm# 10 value 0
Creating row #22 Colm# 11 value 0
Creating row #22 Colm# 12 value 0
Creating row #22 Colm# 13 value 0
Creating row #23 Colm# 8 value 0
Creating row #23 Colm# 9 value 0
Creating row #23 Colm# 10 value 0
Creating row #23 Colm# 11 value 0
Creating row #23 Colm# 12 value 0
Creating row #23 Colm# 13 value 0
Creating row #24 Colm# 8 value 0
Creating row #24 Colm# 9 value 0
Creating row #24 Colm# 10 value 0
Creating row #24 Colm# 11 value 0
Creating row #24 Colm# 12 value 0
Creating row #24 Colm# 13 value 0
Creating row #25 Colm# 8 value 0
Creating row #25 Colm# 9 value 0
Creating row #25 Colm# 10 value 0
Creating row #25 Colm# 11 value 0
Creating row #25 Colm# 12 value 0
Creating row #25 Colm# 13 value 0
Creating row #26 Colm# 8 value 0
Creating row #26 Colm# 9 value 0
Creating row #26 Colm# 10 value 0
Creating row #26 Colm# 11 value 0
Creating row #26 Colm# 12 value 0
Creating row #26 Colm# 13 value 0
Creating row #27 Colm# 8 value 0
Creating row #27 Colm# 9 value 0
Creating row #27 Colm# 10 value 0
Creating row #27 Colm# 11 value 0
Creating row #27 Colm# 12 value 0
Creating row #27 Colm# 13 value 0
Creating row #28 Colm# 8 value 0
Creating row #28 Colm# 9 value 0
Creating row #28 Colm# 10 value 0
Creating row #28 Colm# 11 value 0
Creating row #28 Colm# 12 value 0
Creating row #28 Colm# 13 value 0
Creating row #29 Colm# 8 value 0
Creating row #29 Colm# 9 value 0
Creating row #29 Colm# 10 value 0
Creating row #29 Colm# 11 value 0
Creating row #29 Colm# 12 value 0
Creating row #29 Colm# 13 value 0
Creating row #30 Colm# 8 value 0
Creating row #30 Colm# 9 value 0
Creating row #30 Colm# 10 value 0
Creating row #30 Colm# 11 value 0
Creating row #30 Colm# 12 value 0
Creating row #30 Colm# 13 value 0
Creating row #31 Colm# 8 value 0
Creating row #31 Colm# 9 value 0
Creating row #31 Colm# 10 value 0
Creating row #31 Colm# 11 value 0
Creating row #31 Colm# 12 value 0
Creating row #31 Colm# 13 value 0
Creating row #32 Colm# 8 value 0
Creating row #32 Colm# 9 value 0
Creating row #32 Colm# 10 value 0
Creating row #32 Colm# 11 value 0
Creating row #32 Colm# 12 value 0
Creating row #32 Colm# 13 value 0
Creating row #33 Colm# 8 value 0
Creating row #33 Colm# 9 value 0
Creating row #33 Colm# 10 value 0
Creating row #33 Colm# 11 value 0
Creating row #33 Colm# 12 value 0
Creating row #33 Colm# 13 value 0
***end****
调用上述代码的代码如下:
try {
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/nmdckdl" ,
"root" , "" );
//connection = DBUtility.getConnection();
Statement statement = connection.createStatement();
workbook = new XSSFWorkbook();
FileOutputStream out = new FileOutputStream(new File("incentiveDetails.xlsx"));
XSSFSheet spreadsheet = workbook.createSheet("Individual Incentive");
XSSFRow row=spreadsheet.createRow(1);
/*Creating headers */
spreadsheet.addMergedRegion(new CellRangeAddress(
1, // mention first row here
3, //mention last row here, it is 1 as we are doing a column wise merging
1, //mention first column of merging
1 //mention last column to include in merge
));
createCell(workbook, row, (short) 1, CellStyle.ALIGN_CENTER_SELECTION, CellStyle.VERTICAL_CENTER,"Date");
int year,month;
String name,department,category,token;
year = 2015; month = 11;
String tempDt = year+"-"+month+"-01"; //yyyy-mm-dd
java.sql.Date date = valueOf(tempDt); //convert string date to java.sql.Date
ProductionDetailsDao production = new ProductionDetailsDao();
String oracleDate = production.javaSqlDateToString(date,"yyyy-MM-dd");
SimpleDateFormat oracleFormat = new SimpleDateFormat("yyyy-MM-dd");
String[] temp = oracleDate.split("-");
temp[2]= "__";
String temp2 = String.join("-", temp).toUpperCase();
ResultSet resultSet = statement.executeQuery("select name,token,cat,dep from indinc_t where dt like '"+ temp2 +"' group by token order by token asc");
List<ProductionDetailsBean> productionList = null;
int empCount =0,i=1;
while(resultSet.next()) {
row.setRowNum(1);
empCount++;
System.out.println("***start****");
name = resultSet.getString("Name");
token = resultSet.getString("Token");
category = resultSet.getString("Cat");
department = resultSet.getString("Dep");
System.out.println("name "+name+" token:"+token+" category:"+category + " depart:"+department+" month:"+month+ " year:"+year);
spreadsheet.addMergedRegion(new CellRangeAddress(1,1,i+1,i+6));
createCell(workbook, row, (short) (i+1), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_GENERAL,name);
row=spreadsheet.createRow(2);
spreadsheet.addMergedRegion(new CellRangeAddress(2,2, i+1,i+6));
createCell(workbook, row, (short) (i+1), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_GENERAL,token);
row=spreadsheet.createRow(3);
createCell(workbook, row, (short) (i+1), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_CENTER,"R");
createCell(workbook, row, (short) (i+2), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_CENTER,"W");
createCell(workbook, row, (short) (i+3), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_CENTER,"FH");
createCell(workbook, row, (short) (i+4), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_CENTER,"OT-R");
createCell(workbook, row, (short) (i+5), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_CENTER,"OT-W");
createCell(workbook, row, (short) (i+6), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.ALIGN_CENTER,"OT-FH");
ProductionDetailsDao prodDao = new ProductionDetailsDao();
ProductionDetailsBean prod;
productionList = new ArrayList();
PreparedStatement ps = null;
token = token.toUpperCase();
String data,query ;
int rom,waste,fh,otrom,otwaste,otfh;
try {
query = "SELECT * from indinc_t WHERE upper(token) = ? and dep = ? and cat = ? and dt like ? order by dt";
ps = connection.prepareStatement(query);
if(ps == null){
System.out.println("Error in setting preparerd statement...");
} else {
ps.setString(1, token.toUpperCase());
ps.setString(2, department.toUpperCase());
ps.setString(3, category.toUpperCase());
ps.setString(4, temp2);
ResultSet rs = ps.executeQuery();
int r= 3;
while (rs.next()) {
prod = new ProductionDetailsBean();
rom = rs.getInt("ROM");
waste = rs.getInt("WASTE");
fh = rs.getInt("FHR");
otrom = rs.getInt("ROM85");
otwaste = rs.getInt("WASTE85");
otfh = rs.getInt("FHR85");
date = rs.getDate("DT");// Date received in format yyyy-mm-dd java.sql.Date
System.out.println("date is "+date);
String strDt="";
if( date !=null ) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy");
strDt = sdf.format(date);
}
r++;
row=spreadsheet.createRow(r);
if(empCount == 1) {
createCell(workbook, row, (short) empCount, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,strDt);
}
createCell(workbook, row, (short) (i+1), CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,rom);
createCell(workbook, row, (short) (i+2), CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,waste);
createCell(workbook, row, (short) (i+3), CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,fh);
createCell(workbook, row, (short) (i+4), CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,otrom);
createCell(workbook, row, (short) (i+5), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.VERTICAL_CENTER,otwaste);
createCell(workbook, row, (short) (i+6), CellStyle.ALIGN_CENTER_SELECTION, CellStyle.VERTICAL_CENTER,otfh);
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
i=i+6;
System.out.println("***end****");
}
workbook.write(out);
out.close();
System.out.println("incentive details.xlsx written successfully");
}
catch (SQLException ex) {
System.out.println(ex.getMessage());
Logger.getLogger(DownloadExcel.class.getName()).log(Level.SEVERE, null, ex);
}
最佳答案
你不应该打电话
row.setRowNum(1);
或
spreadsheet.createRow
在这种循环中。第一个调用没有意义,第二个调用将覆盖您在上一个循环迭代中已经创建的行。相反,应在循环之前创建行,然后使用 spreadsheet.getRow
在循环内检索它们。
关于java - Apache POI 未在 Excel 中为每一列呈现输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34529816/
在流处理方面,Apache Beam和Apache Kafka之间有什么区别? 我也试图掌握技术和程序上的差异。 请通过您的经验报告来帮助我理解。 最佳答案 Beam是一种API,它以一种统一的方式使
有点n00b的问题。 如果我使用 Apache Ignite 进行消息传递和事件处理,是否还需要使用 Kafka? 与 Ignite 相比,Kafka 基本上会给我哪些(如果有的话)额外功能? 提前致
Apache MetaModel 是一个数据访问框架,它为发现、探索和查询不同类型的数据源提供了一个通用接口(interface)。 Apache Drill 是一种无架构的 SQL 查询引擎,它通过
Tomcat是一个广泛使用的java web服务器,而Apache也是一个web服务器,它们在实际项目使用中有什么不同? 经过一些研究,我有了一个简单的想法,比如, Apache Tomcat Ja
既然简单地使用 Apache 就足以运行许多 Web 应用程序,那么人们何时以及为什么除了 Apache 之外还使用 Tomcat? 最佳答案 Apache Tomcat是一个网络服务器和 Java
我在某个 VPS( friend 的带 cPanel 的 apache 服务器)上有一个帐户,我在那里有一个 public_html 目录。我们有大约 5-6 个网站: /home/myusernam
我目前正在尝试将模块加载到 Apache,使用 cmake 构建。该模块称为 mod_mapcache。它已成功构建并正确安装在/usr/lib/apache2/modules directroy 中
我对 url 中的问号有疑问。 例如:我有 url test.com/controller/action/part_1%3Fpart_2 (其中 %3F 是 url 编码的问号),并使用此重写规则:R
在同一台机器上,Apache 在端口 80 上运行,Tomcat 在端口 8080 上运行。 Apache 包括 html;css;js;文件并调用 tomcat 服务。 基本上 exampledom
Apache 1 和 Apache 2 的分支有什么区别? 使用一种或另一种的优点和缺点? 似乎 Apache 2 的缺点之一是使用大量内存,但也许它处理请求的速度更快? 最有趣的是 Apache 作
实际上,我们正在使用 Apache 网络服务器来托管我们的 REST-API。 脚本是用 Lua 编写的,并使用 mod-lua 映射。 例如来自 httpd.conf 的实际片段: [...] Lu
我在 apache 上的 ubuntu 中有一个虚拟主机,这不是我的主要配置,我有另一个网页作为我的主要网页,所以我想使用虚拟主机在同一个 IP 上设置这个。 urologyexpert.mx 是我的
我使用 Apache camel 已经很长时间了,发现它是满足各种系统集成相关业务需求的绝佳解决方案。但是几年前我遇到了 Apache Nifi 解决方案。经过一番谷歌搜索后,我发现虽然 Nifi 可
由于两者都是一次处理事件的流框架,这两种技术/流框架之间的核心架构差异是什么? 此外,在哪些特定用例中,一个比另一个更合适? 最佳答案 正如您所提到的,两者都是实时内存计算的流式平台。但是当您仔细观察
apache 文件(如 httpd.conf 和虚拟主机)中使用的语言名称是什么,例如 # Ensure that Apache listens on port 80 Listen 80 D
作为我学习过程的一部分,我认为如果我扩展更多关于 apache 的知识会很好。我有几个问题,虽然我知道有些内容可能需要相当冗长的解释,但我希望您能提供一个概述,以便我知道去哪里寻找。 (最好引用 mo
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 4 个月前关闭。 Improve
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
这个问题在这里已经有了答案: Difference Between Apache Kafka and Camel (Broker vs Integration) (4 个回答) 3年前关闭。 据我所知
我有 2 个使用相同规则的子域,如下所示: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond
我是一名优秀的程序员,十分优秀!