1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-11 02:50:27 +08:00

add w:tblpPr w:jc to table

This commit is contained in:
源文雨
2023-02-24 21:23:22 +08:00
parent bc8697cc87
commit 6e9f1befa5
4 changed files with 135 additions and 23 deletions

View File

@@ -128,3 +128,37 @@ func (f *Docx) AddTableTwips(rowHeights []int64, colWidths []int64) *WTable {
return *(**WTable)(unsafe.Add(unsafe.Pointer(&t), unsafe.Sizeof(uintptr(0))))
}
// Justification allows to set table's horizonal alignment
//
// w:jc 属性的取值可以是以下之一:
// start左对齐。
// center居中对齐。
// end右对齐。
// both两端对齐。
// distribute分散对齐。
func (t *WTable) Justification(val string) *WTable {
if t.TableProperties.Justification == nil {
t.TableProperties.Justification = &Justification{Val: val}
return t
}
t.TableProperties.Justification.Val = val
return t
}
// Justification allows to set table's horizonal alignment
//
// w:jc 属性的取值可以是以下之一:
// start左对齐。
// center居中对齐。
// end右对齐。
// both两端对齐。
// distribute分散对齐。
func (t *WTableRow) Justification(val string) *WTableRow {
if t.TableRowProperties.Justification == nil {
t.TableRowProperties.Justification = &Justification{Val: val}
return t
}
t.TableRowProperties.Justification.Val = val
return t
}