1
0
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:
源文雨
2023-02-21 14:52:22 +08:00
parent 2b5d237bc2
commit 6ba1fa9485
7 changed files with 174 additions and 31 deletions

View File

@@ -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,
}