import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.hssf.util.Region;
public class CellStyleUtil {
public void renderBorder(){
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
HSSFCellStyle setBorder = wb.createCellStyle();
setBorder.setFillForegroundColor((short) 13);
setBorder.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
setBorder.setBorderBottom(HSSFCellStyle.BORDER_THIN);
setBorder.setBorderLeft(HSSFCellStyle.BORDER_THIN);
setBorder.setBorderTop(HSSFCellStyle.BORDER_THIN);
setBorder.setBorderRight(HSSFCellStyle.BORDER_THIN);
setBorder.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont font = wb.createFont();
font.setFontName("黑体");
font.setFontHeightInPoints((short) 16);
HSSFFont font2 = wb.createFont();
font2.setFontName("仿宋_GB2312");
font2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font2.setFontHeightInPoints((short) 12);
setBorder.setFont(font);
sheet.setColumnWidth(0, 3766);
setBorder.setWrapText(true);
Region region1 = new Region(0, (short) 0, 0, (short) 6);
sheet.addMergedRegion(region1);
}
}