🎨 Add page number generation and refine the methodology

This commit is contained in:
2025-04-16 20:50:40 +08:00
parent 6b4be90900
commit 53a154a6df
8 changed files with 1150 additions and 56 deletions

View File

@@ -115,6 +115,16 @@ func (p *Paragraph) SetSpacingLine(spacing int, rule string) *Paragraph {
return p
}
// SetLineSpacing 设置行距
func (p *Paragraph) SetLineSpacing(lineSpacing float64, rule string) *Paragraph {
// Word中行距值的计算
// 1.5倍行距 = 360 (240 * 1.5)
// 2.0倍行距 = 480 (240 * 2.0)
// 3.0倍行距 = 720 (240 * 3.0)
spacing := int(240 * lineSpacing)
return p.SetSpacingLine(spacing, rule)
}
// SetKeepNext 设置与下段同页
func (p *Paragraph) SetKeepNext(keepNext bool) *Paragraph {
p.Properties.KeepNext = keepNext
@@ -148,6 +158,16 @@ func (p *Paragraph) SetNumbering(numID, numLevel int) *Paragraph {
// SetBorder 设置边框
func (p *Paragraph) SetBorder(position string, style string, size int, color string, space int) *Paragraph {
// 如果style为空设置为"none"
if style == "" {
style = "none"
}
// 如果color为空设置为默认颜色黑色
if color == "" {
color = "000000"
}
border := &Border{
Style: style,
Size: size,