Browse Source

merge maybeaddcol

rentiansheng 7 years ago
parent
commit
1dc2acd075
1 changed files with 5 additions and 3 deletions
  1. 5 3
      sheet.go

+ 5 - 3
sheet.go

@@ -60,16 +60,18 @@ func (s *Sheet) AddRow() *Row {
 func (s *Sheet) maybeAddCol(cellCount int) {
 	if cellCount > s.MaxCol {
 		loopCnt := cellCount - s.MaxCol
+		currIndex := s.MaxCol
 		for i := 0; i < loopCnt; i++ {
+
 			col := &Col{
 				style:     NewStyle(),
-				Min:       cellCount,
-				Max:       cellCount,
+				Min:       currIndex,
+				Max:       currIndex,
 				Hidden:    false,
 				Collapsed: false}
 			s.Cols = append(s.Cols, col)
+			currIndex++
 		}
-
 		s.MaxCol = cellCount
 	}
 }