Mercurial > gemma
changeset 5343:bb6761abd81d extented-report
XLSX template: Copy column and row height explicitly.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 18 Jun 2021 13:43:21 +0200 |
parents | 08dc7e5de1f5 |
children | 7df6062a1371 |
files | pkg/xlsx/templater.go |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/xlsx/templater.go Fri Jun 18 12:05:57 2021 +0200 +++ b/pkg/xlsx/templater.go Fri Jun 18 13:43:21 2021 +0200 @@ -232,6 +232,26 @@ if err1 != nil || err2 != nil { continue } + + sc, sr, err1 := excelize.SplitCellName(src) + dc, dr, err2 := excelize.SplitCellName(dst) + if err1 != nil || err2 != nil { + continue + } + cw, err1 := e.template.GetColWidth(e.sourceSheet, sc) + rh, err1 := e.template.GetRowHeight(e.sourceSheet, sr) + if err1 != nil || err2 != nil { + continue + } + + if e.template.SetColWidth(e.destinationSheet, dc, dc, cw) != nil { + continue + } + + if e.template.SetRowHeight(e.destinationSheet, dr, rh) != nil { + continue + } + if s, err := e.template.GetCellStyle(e.sourceSheet, src); err == nil { e.template.SetCellStyle(e.destinationSheet, dst, dst, s) }