Skip to content

Commit

Permalink
Add tables loop to document's Paragraphs func (unidoc#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov authored and gunnsth committed May 11, 2019
1 parent c01764e commit 06b1c96
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion document/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func (d *Document) StructuredDocumentTags() []StructuredDocumentTag {
return ret
}

// Paragraphs returns all of the paragraphs in the document body.
// Paragraphs returns all of the paragraphs in the document body including tables.
func (d *Document) Paragraphs() []Paragraph {
ret := []Paragraph{}
if d.x.Body == nil {
Expand All @@ -443,6 +443,14 @@ func (d *Document) Paragraphs() []Paragraph {
}
}
}

for _, t := range d.Tables() {
for _, r := range t.Rows() {
for _, c := range r.Cells() {
ret = append(ret, c.Paragraphs()...)
}
}
}
return ret
}

Expand Down

0 comments on commit 06b1c96

Please sign in to comment.