v0.0.461
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m17s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m17s
This commit is contained in:
parent
194ea4ace5
commit
59963adf74
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.460"
|
||||
const GoextVersion = "0.0.461"
|
||||
|
||||
const GoextVersionTimestamp = "2024-05-20T00:38:04+0200"
|
||||
const GoextVersionTimestamp = "2024-05-20T00:52:49+0200"
|
||||
|
@ -126,6 +126,10 @@ func (b *WPDFBuilder) SetX(x float64) {
|
||||
b.b.SetX(x)
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) IncX(dx float64) {
|
||||
b.b.SetX(b.b.GetX() + dx)
|
||||
}
|
||||
|
||||
func (b *WPDFBuilder) GetX() float64 {
|
||||
return b.b.GetX()
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ type PDFCellOpt struct {
|
||||
textColor *PDFColor
|
||||
borderColor *PDFColor
|
||||
fillColor *PDFColor
|
||||
autoWidthPaddingX *float64
|
||||
}
|
||||
|
||||
func NewPDFCellOpt() *PDFCellOpt {
|
||||
@ -113,6 +114,11 @@ func (opt *PDFCellOpt) AutoWidth() *PDFCellOpt {
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt *PDFCellOpt) AutoWidthPaddingX(v float64) *PDFCellOpt {
|
||||
opt.autoWidthPaddingX = &v
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt *PDFCellOpt) TextColor(cr, cg, cb int) *PDFCellOpt {
|
||||
opt.textColor = langext.Ptr(rgbToColor(cr, cg, cb))
|
||||
return opt
|
||||
@ -164,6 +170,7 @@ func (b *WPDFBuilder) Cell(txt string, opts ...*PDFCellOpt) {
|
||||
var textColor *PDFColor
|
||||
var borderColor *PDFColor
|
||||
var fillColor *PDFColor
|
||||
autoWidthPaddingX := float64(0)
|
||||
|
||||
for _, opt := range opts {
|
||||
width = langext.Coalesce(opt.width, width)
|
||||
@ -183,6 +190,7 @@ func (b *WPDFBuilder) Cell(txt string, opts ...*PDFCellOpt) {
|
||||
textColor = langext.CoalesceOpt(opt.textColor, textColor)
|
||||
borderColor = langext.CoalesceOpt(opt.borderColor, borderColor)
|
||||
fillColor = langext.CoalesceOpt(opt.fillColor, fillColor)
|
||||
autoWidthPaddingX = langext.Coalesce(opt.autoWidthPaddingX, autoWidthPaddingX)
|
||||
}
|
||||
|
||||
if fontNameOverride != nil || fontStyleOverride != nil || fontSizeOverride != nil {
|
||||
@ -219,7 +227,7 @@ func (b *WPDFBuilder) Cell(txt string, opts ...*PDFCellOpt) {
|
||||
}
|
||||
|
||||
if autoWidth {
|
||||
width = b.b.GetStringWidth(txtTR)
|
||||
width = b.b.GetStringWidth(txtTR) + autoWidthPaddingX
|
||||
}
|
||||
|
||||
b.b.CellFormat(width, height, txtTR, string(border), int(ln), string(align), fill, link, linkStr)
|
||||
|
Loading…
Reference in New Issue
Block a user