文字長度驗證
//Add a TextLength Validation to column G
var val5 = worksheet.DataValidations.AddTextLengthValidation("G:G");
//For TextLenght Validation, you have to set error message to true
val5.ShowErrorMessage = true;
//Minimum allowed text lenght
val5.Formula.Value = 3;
//Maximum allowed text lenght
val5.Formula2.Value = 5;
val5.AllowBlank = true;