|
|
@ -16,20 +16,31 @@ func main() { |
|
|
|
} |
|
|
|
|
|
|
|
pathFile := config.Book |
|
|
|
savePath := config.Save |
|
|
|
sheetName := config.Sheet |
|
|
|
glog.Info("打开文件文件:", pathFile) |
|
|
|
cellNum := config.CellNum |
|
|
|
long := config.Longs |
|
|
|
types := config.Types |
|
|
|
ranges := config.Ranges |
|
|
|
glog.Info("配置文件:", pathFile, savePath, sheetName, cellNum, long, types, ranges) |
|
|
|
xlsx, err := excelize.OpenFile(pathFile) |
|
|
|
if err != nil { |
|
|
|
glog.Error("打开文件失败!") |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
glog.Info("开始-读取文件内容获取异常单元格列表...") |
|
|
|
cells, err := readExcel2(xlsx, sheetName) |
|
|
|
dvRange := excelize.NewDataValidation(true) |
|
|
|
dvRange.Sqref = "A1:B2" |
|
|
|
dvRange.SetRange(10, 20, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) |
|
|
|
dvRange.SetError(excelize.DataValidationErrorStyleStop, "发现错误", "您输入的内容不符合规范") |
|
|
|
xlsx.AddDataValidation(sheetName, dvRange) |
|
|
|
err = xlsx.SaveAs(savePath) |
|
|
|
if err != nil { |
|
|
|
glog.Info("发生异常:", err) |
|
|
|
return |
|
|
|
} |
|
|
|
for _, s := range cells { |
|
|
|
|
|
|
|
for _, s := range cellNum { |
|
|
|
glog.Info("xxx:", s) |
|
|
|
} |
|
|
|
|
|
|
@ -96,9 +107,13 @@ func initFunc2() *Config2 { |
|
|
|
|
|
|
|
type Config2 struct { |
|
|
|
Book string `yaml:"文件"` |
|
|
|
Save string `yaml:"另存为"` |
|
|
|
Sheet string `yaml:"页签"` |
|
|
|
RowNum string `yaml:"开始行"` |
|
|
|
RowNum int `yaml:"开始行"` |
|
|
|
CellNum []string `yaml:"开始列"` |
|
|
|
Longs []string `yaml:"长度"` |
|
|
|
Types []string `yaml:"类型"` |
|
|
|
Ranges []string `yaml:"范围"` |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|