1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-10 10:23:19 +08:00

add SplitByParagraph

This commit is contained in:
源文雨
2023-03-09 17:20:17 +08:00
parent 2a630f6342
commit 69a899d4a5
12 changed files with 282 additions and 37 deletions

View File

@@ -23,7 +23,7 @@ package docx
// AddTable add a new table to body by col*row
//
// unit: twips (1/20 point)
func (f *Docx) AddTable(row int, col int) *WTable {
func (f *Docx) AddTable(row int, col int) *Table {
trs := make([]*WTableRow, row)
for i := 0; i < row; i++ {
cells := make([]*WTableCell, col)
@@ -40,7 +40,7 @@ func (f *Docx) AddTable(row int, col int) *WTable {
TableCells: cells,
}
}
tbl := &WTable{
tbl := &Table{
TableProperties: &WTableProperties{
Width: &WTableWidth{Type: "auto"},
TableBorders: &WTableBorders{
@@ -65,7 +65,7 @@ func (f *Docx) AddTable(row int, col int) *WTable {
// AddTableTwips add a new table to body by height and width
//
// unit: twips (1/20 point)
func (f *Docx) AddTableTwips(rowHeights []int64, colWidths []int64) *WTable {
func (f *Docx) AddTableTwips(rowHeights []int64, colWidths []int64) *Table {
grids := make([]*WGridCol, len(colWidths))
trs := make([]*WTableRow, len(rowHeights))
for i, w := range colWidths {
@@ -95,7 +95,7 @@ func (f *Docx) AddTableTwips(rowHeights []int64, colWidths []int64) *WTable {
}
}
}
tbl := &WTable{
tbl := &Table{
TableProperties: &WTableProperties{
Width: &WTableWidth{Type: "auto"},
TableBorders: &WTableBorders{
@@ -127,7 +127,7 @@ func (f *Docx) AddTableTwips(rowHeights []int64, colWidths []int64) *WTable {
// end右对齐。
// both两端对齐。
// distribute分散对齐。
func (t *WTable) Justification(val string) *WTable {
func (t *Table) Justification(val string) *Table {
if t.TableProperties.Justification == nil {
t.TableProperties.Justification = &Justification{Val: val}
return t