-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paragraphproperties.go
61 lines (52 loc) · 1.55 KB
/
paragraphproperties.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
package drawing
import (
"go.devnw.com/ooxml"
"go.devnw.com/ooxml/schema/soo/dml"
)
// ParagraphProperties allows controlling paragraph properties.
type ParagraphProperties struct {
x *dml.CT_TextParagraphProperties
}
// MakeParagraphProperties constructs a new ParagraphProperties wrapper.
func MakeParagraphProperties(x *dml.CT_TextParagraphProperties) ParagraphProperties {
return ParagraphProperties{x}
}
// X returns the inner wrapped XML type.
func (p ParagraphProperties) X() *dml.CT_TextParagraphProperties {
return p.x
}
// SetBulletFont controls the font for the bullet character.
func (p ParagraphProperties) SetBulletFont(f string) {
if f == "" {
p.x.BuFont = nil
} else {
p.x.BuFont = dml.NewCT_TextFont()
p.x.BuFont.TypefaceAttr = f
}
}
// SetBulletChar sets the bullet character for the paragraph.
func (p ParagraphProperties) SetBulletChar(c string) {
if c == "" {
p.x.BuChar = nil
} else {
p.x.BuChar = dml.NewCT_TextCharBullet()
p.x.BuChar.CharAttr = c
}
}
// SetLevel sets the level of indentation of a paragraph.
func (p ParagraphProperties) SetLevel(idx int32) {
p.x.LvlAttr = office.Int32(idx)
}
// SetNumbered controls if bullets are numbered or not.
func (p ParagraphProperties) SetNumbered(scheme dml.ST_TextAutonumberScheme) {
if scheme == dml.ST_TextAutonumberSchemeUnset {
p.x.BuAutoNum = nil
} else {
p.x.BuAutoNum = dml.NewCT_TextAutonumberBullet()
p.x.BuAutoNum.TypeAttr = scheme
}
}
// SetAlign controls the paragraph alignment
func (p ParagraphProperties) SetAlign(a dml.ST_TextAlignType) {
p.x.AlgnAttr = a
}