forked from unidoc/unioffice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfooter.go
42 lines (36 loc) · 1.17 KB
/
footer.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
// Copyright 2017 Baliance. All rights reserved.
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased by contacting [email protected].
package document
import wml "baliance.com/gooxml/schema/schemas.openxmlformats.org/wordprocessingml"
// Footer is a footer for a document section.
type Footer struct {
d *Document
x *wml.Ftr
}
// X returns the inner wrapped XML type.
func (h Footer) X() *wml.Ftr {
return h.x
}
// AddParagraph adds a paragraph to the footer.
func (h Footer) AddParagraph() Paragraph {
bc := wml.NewEG_ContentBlockContent()
h.x.EG_ContentBlockContent = append(h.x.EG_ContentBlockContent, bc)
p := wml.NewCT_P()
bc.P = append(bc.P, p)
return Paragraph{h.d, p}
}
// Index returns the index of the footer within the document. This is used to
// form its zip packaged filename as well as to match it with its relationship
// ID.
func (h Footer) Index() int {
for i, hdr := range h.d.footers {
if hdr == h.x {
return i
}
}
return -1
}