|
|
|
@ -19,6 +19,8 @@ func TestDataValidation(t *testing.T) {
|
|
|
|
|
dvRange.Sqref = "A1:B2"
|
|
|
|
|
dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorBetween)
|
|
|
|
|
dvRange.SetError(DataValidationErrorStyleStop, "error title", "error body")
|
|
|
|
|
dvRange.SetError(DataValidationErrorStyleWarning, "error title", "error body")
|
|
|
|
|
dvRange.SetError(DataValidationErrorStyleInformation, "error title", "error body")
|
|
|
|
|
xlsx.AddDataValidation("Sheet1", dvRange)
|
|
|
|
|
|
|
|
|
|
dvRange = NewDataValidation(true)
|
|
|
|
@ -36,12 +38,20 @@ func TestDataValidation(t *testing.T) {
|
|
|
|
|
xlsx.SetCellStr("Sheet1", "E2", "E2")
|
|
|
|
|
xlsx.SetCellStr("Sheet1", "E3", "E3")
|
|
|
|
|
dvRange = NewDataValidation(true)
|
|
|
|
|
dvRange.Sqref = "A7:B8"
|
|
|
|
|
dvRange.SetSqref("A7:B8")
|
|
|
|
|
dvRange.SetSqref("A7:B8")
|
|
|
|
|
dvRange.SetSqrefDropList("$E$1:$E$3", true)
|
|
|
|
|
err := dvRange.SetSqrefDropList("$E$1:$E$3", false)
|
|
|
|
|
t.Log(err)
|
|
|
|
|
xlsx.AddDataValidation("Sheet1", dvRange)
|
|
|
|
|
|
|
|
|
|
dvRange = NewDataValidation(true)
|
|
|
|
|
dvRange.SetDropList(make([]string, 258))
|
|
|
|
|
err = dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorGreaterThan)
|
|
|
|
|
t.Log(err)
|
|
|
|
|
|
|
|
|
|
// Test write file to given path.
|
|
|
|
|
err := xlsx.SaveAs("./test/Book_data_validation.xlsx")
|
|
|
|
|
err = xlsx.SaveAs("./test/Book_data_validation.xlsx")
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|