-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blanks.go
36 lines (30 loc) · 819 Bytes
/
blanks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2017 Andrey Gayvoronsky <plandem@gmail.com>
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package rule
import (
"github.com/roboninc/xlsx/format/styles"
"github.com/roboninc/xlsx/internal/ml"
"github.com/roboninc/xlsx/internal/ml/primitives"
)
type blanksRule struct {
baseRule
}
// Blanks is helper object to set specific options for rule
var Blanks blanksRule
func (x blanksRule) initIfRequired(r *Info) {
if !r.initialized {
r.initialized = true
r.validator = Blanks
r.rule = &ml.ConditionalRule{
Type: primitives.ConditionTypeContainsBlanks,
Formula: []ml.Formula{`LEN(TRIM(:cell:))=0`},
}
}
}
func (x blanksRule) Styles(s *styles.Info) Option {
return func(r *Info) {
x.initIfRequired(r)
r.style = s
}
}