[英]How to apply style to a row uptill a specified cell in Apache POI
我想將邊框樣式應用於一行而不是整個行。 我想將其應用到第33單元。 我該怎么做??
任何想法??
創建所需的樣式:
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);
對先前創建的行重復創建單元格的過程
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.