mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-27 06:30:24 +08:00
House cleaning
This commit is contained in:
26
apipara.go
Normal file
26
apipara.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package docxlib
|
||||
|
||||
// AddParagraph adds a new paragraph
|
||||
func (f *DocxLib) AddParagraph() *Paragraph {
|
||||
p := &Paragraph{
|
||||
Data: make([]ParagraphChild, 0),
|
||||
file: f,
|
||||
}
|
||||
|
||||
f.Document.Body.Paragraphs = append(f.Document.Body.Paragraphs, p)
|
||||
return p
|
||||
}
|
||||
|
||||
func (f *DocxLib) Paragraphs() []*Paragraph {
|
||||
return f.Document.Body.Paragraphs
|
||||
}
|
||||
|
||||
func (p *Paragraph) Runs() (ret []*Run) {
|
||||
data := p.Data
|
||||
for _, d := range data {
|
||||
if d.Run != nil {
|
||||
ret = append(ret, d.Run)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user