diff --git a/apipara.go b/apipara.go index eae5ea4..e5ac319 100644 --- a/apipara.go +++ b/apipara.go @@ -80,14 +80,50 @@ func (p *Paragraph) Style(val string) *Paragraph { } // NumPr number properties -func (p *Paragraph) NumPr(val string) *Paragraph { +func (p *Paragraph) NumPr(numId, ilvl string) *Paragraph { if p.Properties == nil { p.Properties = &ParagraphProperties{} } + // Initialize run properties if not exist + if p.Properties.RunProperties == nil { + p.Properties.RunProperties = &RunProperties{} + } p.Properties.NumProperties = &NumProperties{ NumId: &NumId{ - Val: val, + Val: numId, + }, + Ilvl: &Ilevel{ + Val: ilvl, }, } return p } + +// NumFont sets the font for numbering +func (p *Paragraph) NumFont(ascii, eastAsia, hansi, hint string) *Paragraph { + if p.Properties == nil { + p.Properties = &ParagraphProperties{} + } + if p.Properties.RunProperties == nil { + p.Properties.RunProperties = &RunProperties{} + } + p.Properties.RunProperties.Fonts = &RunFonts{ + ASCII: ascii, + EastAsia: eastAsia, + HAnsi: hansi, + Hint: hint, + } + return p +} + +// NumSize sets the size for numbering +func (p *Paragraph) NumSize(size string) *Paragraph { + if p.Properties == nil { + p.Properties = &ParagraphProperties{} + } + if p.Properties.RunProperties == nil { + p.Properties.RunProperties = &RunProperties{} + } + p.Properties.RunProperties.Size = &Size{Val: size} + return p +}