0
A
回答
1
创建要样式:
HSSFCellStyle my_style = my_workbook.createCellStyle(); /* Draw a thin left border */ my_style.setBorderLeft(HSSFCellStyle.BORDER_THIN);/* Add medium right border */ my_style.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);/* Add dashed top border */ my_style.setBorderTop(HSSFCellStyle.BORDER_DASHED); /* Add dotted bottom border */ my_style.setBorderBottom(HSSFCellStyle.BORDER_DOTTED);
创建一个行:
/*Create a row */ Row row = my_sheet.createRow(0);
添加细胞行成你想要的边框样式:
/*Now add cells to the row*/ Cell cell = row.createCell(0); cell.setCellValue("Add Border Example - 1 "); /*Now add style to your cell cell.setCellStyle(my_style);
重复为之前创建的行创建单元格的过程