電話號碼約束
//對貨幣型別嘗試相同的方法,格式為“$#,###。00”和日期“m / d / yy h:mm”
XSSFFont defaultFont = (XSSFFont)workbook.CreateFont();
defaultFont.FontHeightInPoints = (short)10;
defaultFont.FontName = "Arial";
XSSFCellStyle phoneCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFDataFormat phoneDataFormat = (XSSFDataFormat)workbook.CreateDataFormat();
phoneCellStyle.SetDataFormat(phoneDataFormat.GetFormat("000-000-0000"));
phoneCellStyle.FillBackgroundColor = IndexedColors.LightYellow.Index;
dvConstraint = (XSSFDataValidationConstraint)validationHelper.CreateintConstraint(OperatorType.BETWEEN, "1000000000", "9999999999");
sheet.AddValidationData(dataValidation);
sheet.SetDefaultColumnStyle(headerCount, phoneCellStyle);