POI导出EXCEL设置高度和宽度
生活随笔
收集整理的這篇文章主要介紹了
POI导出EXCEL设置高度和宽度
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
-------------------------------------------------------------------------------SSFRow hssfRow = sheet.createRow(0);//創建表頭hssfRow.setHeight((short)1000); //設置行高
sheet.setColumnWidth(列的下標, 256*30); //設置某一列寬度POI導出EXCEL設置跨行跨列(在所有數據行和列創建完成后再執行)
CellRangeAddress range= new CellRangeAddress(起始行號,終止行號,起始列號,終止列號);
sheet.addMergedRegion(range);POI設置上下左右居中:
HSSFCellStyle style = workbook.createCellStyle();//設置列樣式
style.setAlignment(HorizontalAlignment.CENTER);// 水平居中
style.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中HSSFCell titleCell=hssfRow.createCell(initColumn);
titleCell.setCellValue("測試");
titleCell.setCellStyle(style);//設置樣式
總結
以上是生活随笔為你收集整理的POI导出EXCEL设置高度和宽度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android屏幕适配无效_Androi
- 下一篇: IrregularGridCollect