mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-26 22:20:24 +08:00
House cleaning
This commit is contained in:
34
apirun.go
Normal file
34
apirun.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package docxlib
|
||||
|
||||
// Color allows to set run color
|
||||
func (r *Run) Color(color string) *Run {
|
||||
r.RunProperties.Color = &Color{
|
||||
Val: color,
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// Size allows to set run size
|
||||
func (r *Run) Size(size int) *Run {
|
||||
r.RunProperties.Size = &Size{
|
||||
Val: size * 2,
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// AddText add text to paragraph
|
||||
func (p *Paragraph) AddText(text string) *Run {
|
||||
t := &Text{
|
||||
Text: text,
|
||||
}
|
||||
|
||||
run := &Run{
|
||||
Text: t,
|
||||
RunProperties: &RunProperties{},
|
||||
}
|
||||
|
||||
p.Data = append(p.Data, ParagraphChild{Run: run})
|
||||
|
||||
return run
|
||||
}
|
||||
Reference in New Issue
Block a user