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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user