henryyan
12/21/2011 - 7:40 AM

gistfile1.txt


	/**
	 * 验证固定列是否存在
	 * @param row		sheet对象
	 * @param fixedColumns	验证的固定列
	 * @throws TemplateException	指定列不存在时
	 */
	private static boolean checkFixedColumns(HSSFRow row, String[] fixedColumns) throws TemplateException {
		HSSFCell cell = null;
		for (int i = 0; i < fixedColumns.length; i++) {
			cell = row.getCell(i);
			String column = fixedColumns[i];
			String stringCellValue = cell.getStringCellValue();
			if (StringUtils.defaultString(stringCellValue).equals(column)) {
				continue;
			} else {
				throw new TemplateException("固定列[" + column + "]不存在,实际为:" + stringCellValue);
			}
		}
		return true;
	}