Add PostgreSQL checkpoint functionality and update related database operations
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -279,6 +279,8 @@ func SetColAutoWidth(xlsx *excelize.File, sheetName string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
const minColWidth = 10
|
||||
const maxColWidth = 80
|
||||
for idx, col := range cols {
|
||||
largestWidth := 0
|
||||
for _, rowCell := range col {
|
||||
@@ -287,12 +289,22 @@ func SetColAutoWidth(xlsx *excelize.File, sheetName string) error {
|
||||
largestWidth = cellWidth
|
||||
}
|
||||
}
|
||||
// Keep a sane minimum so sheets that rely on computed content
|
||||
// (for example pivot output populated by Excel) don't collapse to width 0.
|
||||
if largestWidth < minColWidth {
|
||||
largestWidth = minColWidth
|
||||
}
|
||||
if largestWidth > maxColWidth {
|
||||
largestWidth = maxColWidth
|
||||
}
|
||||
//fmt.Printf("SetColAutoWidth calculated largest width for column index '%d' is '%d'\n", idx, largestWidth)
|
||||
name, err := excelize.ColumnNumberToName(idx + 1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
xlsx.SetColWidth(sheetName, name, name, float64(largestWidth))
|
||||
if err := xlsx.SetColWidth(sheetName, name, name, float64(largestWidth)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// No errors at this point
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user