Closed ZongrongLi closed 1 year ago
v3@v3.2.3
func (s *Sheet) SetColAutoWidth(colIndex int, width func(string) float64) error { s.mustBeOpen() largestWidth := 0.0 rowVisitor := func(r *Row) error { cell := r.GetCell(colIndex) value, err := cell.FormattedValue() if err != nil { return err } if width(value) > largestWidth { largestWidth = width(value) } return nil } err := s.ForEachRow(rowVisitor) if err != nil { return err } fmt.Println("====>>", colIndex, colIndex, largestWidth) s.SetColWidth(colIndex, colIndex, largestWidth) return nil }
cell := r.GetCell(colIndex) // get col of index start from 0
and
s.SetColWidth(colIndex, colIndex, largestWidth) //set width of col from index start from 1
Stale issue message
v3@v3.2.3
and