Skip to content

Commit

Permalink
Added ParagraphStyleProperties methods for alignment and indent
Browse files Browse the repository at this point in the history
  • Loading branch information
preciselytom authored and tbaliance committed Nov 15, 2018
1 parent 372ab21 commit 0e43c60
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions document/paragraphstyleproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ func (p ParagraphStyleProperties) X() *wml.CT_PPrGeneral {
return p.x
}

// SetAlignment controls the paragraph alignment
func (p ParagraphStyleProperties) SetAlignment(align wml.ST_Jc) {
if align == wml.ST_JcUnset {
p.x.Jc = nil
} else {
p.x.Jc = wml.NewCT_Jc()
p.x.Jc.ValAttr = align
}
}

// AddTabStop adds a tab stop to the paragraph.
func (p ParagraphStyleProperties) AddTabStop(position measurement.Distance, justificaton wml.ST_TabJc, leader wml.ST_TabTlc) {
if p.x.Tabs == nil {
Expand Down Expand Up @@ -104,3 +114,28 @@ func (p ParagraphStyleProperties) SetLeftIndent(m measurement.Distance) {
p.x.Ind.LeftAttr.Int64 = gooxml.Int64(int64(m / measurement.Twips))
}
}

// SetStartIndent controls the start indent of the paragraph.
func (p ParagraphStyleProperties) SetStartIndent(m measurement.Distance) {
if p.x.Ind == nil {
p.x.Ind = wml.NewCT_Ind()
}
if m == measurement.Zero {
p.x.Ind.StartAttr = nil
} else {
p.x.Ind.StartAttr = &wml.ST_SignedTwipsMeasure{}
p.x.Ind.StartAttr.Int64 = gooxml.Int64(int64(m / measurement.Twips))
}
}
// SetHangingIndent controls the hanging indent of the paragraph.
func (p ParagraphStyleProperties) SetHangingIndent(m measurement.Distance) {
if p.x.Ind == nil {
p.x.Ind = wml.NewCT_Ind()
}
if m == measurement.Zero {
p.x.Ind.HangingAttr = nil
} else {
p.x.Ind.HangingAttr = &sharedTypes.ST_TwipsMeasure{}
p.x.Ind.HangingAttr.ST_UnsignedDecimalNumber = gooxml.Uint64(uint64(m / measurement.Twips))
}
}

0 comments on commit 0e43c60

Please sign in to comment.