mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-17 23:52:34 +08:00
add w:jc & w:tab
This commit is contained in:
18
apitext.go
18
apitext.go
@@ -1,7 +1,25 @@
|
||||
package docxlib
|
||||
|
||||
import "encoding/xml"
|
||||
|
||||
// AddTab adds tab to para
|
||||
func (p *Paragraph) AddTab() *Run {
|
||||
run := &Run{
|
||||
RunProperties: &RunProperties{},
|
||||
FrontTab: []struct {
|
||||
XMLName xml.Name "xml:\"w:tab,omitempty\""
|
||||
}{{}},
|
||||
}
|
||||
p.Children = append(p.Children, ParagraphChild{Run: run})
|
||||
return run
|
||||
}
|
||||
|
||||
// AddText adds text to paragraph
|
||||
func (p *Paragraph) AddText(text string) *Run {
|
||||
if text == "\t" {
|
||||
return p.AddTab()
|
||||
}
|
||||
|
||||
t := &Text{
|
||||
Text: text,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user