//셀 타입이 NUMERIC일 경우 if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { //셀 타입을 STRING 으로 변경후 getStringCellValue() cell.setCellType(Cell.CELL_TYPE_STRING ); return cell.getStringCellValue(); } else { return cell.getStringCellValue(); }
String imagePath = "/var/www/html" + one.getImagePath(); final InputStream stream = new FileInputStream(imagePath); byte[] bytes = IOUtils.toByteArray(stream); final CreationHelper helper = rstWb.getCreationHelper(); final Drawing drawing = rstSt.createDrawingPatriarch(); final ClientAnchor anchor = helper.createClientAnchor(); anchor.setAnchorType( ClientAnchor.MOVE_AND_RESIZE ); final int pict..
cell.getCellType(); - Cell.class - public static final int CELL_TYPE_NUMERIC = 0; public static final int CELL_TYPE_STRING = 1; public static final int CELL_TYPE_FORMULA = 2; public static final int CELL_TYPE_BLANK = 3; public static final int CELL_TYPE_BOOLEAN = 4; public static final int CELL_TYPE_ERROR = 5;
CellStyle style= rstWb.createCellStyle(); style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); //세로 가운데 정렬 - CellStyle.class - public static final short VERTICAL_TOP = 0; public static final short VERTICAL_CENTER = 1; public static final short VERTICAL_BOTTOM = 2; public static final short VERTICAL_JUSTIFY = 3;
CellStyle style= rstWb.createCellStyle(); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); //가운데 정렬 - CellStyle.class - public static final short ALIGN_GENERAL = 0; public static final short ALIGN_LEFT = 1; public static final short ALIGN_CENTER = 2; public static final short ALIGN_RIGHT = 3;
sheet.getPrintSetup().setLandscape(true);
import java.io.FileOutputStream; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.CellRangeAddress; public class Write { public Write() { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet st = wb.createSheet("Test Sheet"); st.addMergedRegion(new CellRangeAddress( 0, //시작 행번호 2, //마지막 행번호 2, //시작 열번호 4 //마지막 열번호 )); F..