POI拷贝Sheet包括每个单元格的style

注意本例需要jxls的支持

 

/**
	 * copy all rows include styles from source sheet to target sheet
	 * @param srcSheet
	 * @param targetSheet
	 */
	public static void copySheet(HSSFSheet srcSheet, HSSFSheet targetSheet){
		Iterator it = srcSheet.rowIterator();
		while(it.hasNext()){
			HSSFRow srcRow = (HSSFRow) it.next();
			Util.copyRow(srcSheet, targetSheet, srcRow, targetSheet.createRow(srcRow.getRowNum()));
		}
	}
 

你可能感兴趣的:(Gmail)