forked from plandem/xlsx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alignment.go
62 lines (49 loc) · 1.4 KB
/
alignment.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 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 styles
import (
"github.com/miscoler/xlsx/internal/ml/primitives"
)
type alignmentOption byte
//Alignment is a 'namespace' for all possible settings for alignment
var Alignment alignmentOption
func (f *alignmentOption) VAlign(va primitives.VAlignType) Option {
return func(s *Info) {
s.styleInfo.Alignment.Vertical = va
}
}
func (f *alignmentOption) HAlign(ha primitives.HAlignType) Option {
return func(s *Info) {
s.styleInfo.Alignment.Horizontal = ha
}
}
func (f *alignmentOption) TextRotation(angle int) Option {
return func(s *Info) {
s.styleInfo.Alignment.TextRotation = angle
}
}
func (f *alignmentOption) WrapText(s *Info) {
s.styleInfo.Alignment.WrapText = true
}
func (f *alignmentOption) Indent(i int) Option {
return func(s *Info) {
s.styleInfo.Alignment.Indent = i
}
}
func (f *alignmentOption) RelativeIndent(i int) Option {
return func(s *Info) {
s.styleInfo.Alignment.RelativeIndent = i
}
}
func (f *alignmentOption) JustifyLastLine(s *Info) {
s.styleInfo.Alignment.JustifyLastLine = true
}
func (f *alignmentOption) ShrinkToFit(s *Info) {
s.styleInfo.Alignment.ShrinkToFit = true
}
func (f *alignmentOption) ReadingOrder(i int) Option {
return func(s *Info) {
s.styleInfo.Alignment.ReadingOrder = i
}
}