Skip to content

Commit

Permalink
added more column numbers start at 1 doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleypeabody committed Jun 9, 2024
1 parent 7b4dc44 commit 472402f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions col.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Col struct {
// columns in the range min to max (inclusive). Note, in order for
// this Col to do anything useful you must set some of its parameters
// and then apply it to a Sheet by calling sheet.SetColParameters.
// Column numbers start from 1.
func NewColForRange(min, max int) *Col {
if min < 1 {
panic("min col must be >= 1")
Expand Down
4 changes: 4 additions & 0 deletions sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func (s *Sheet) Row(idx int) (*Row, error) {
}

// Return the Col that applies to this Column index, or return nil if no such Col exists
// Column numbers start from 1.
func (s *Sheet) Col(idx int) *Col {
s.mustBeOpen()
if s.Cols == nil {
Expand Down Expand Up @@ -354,6 +355,7 @@ func (s *Sheet) Cell(row, col int) (*Cell, error) {

// Set the parameters of a column. Parameters are passed as a pointer
// to a Col structure which you much construct yourself.
// Column numbers start from 1.
func (s *Sheet) SetColParameters(col *Col) {
s.mustBeOpen()
if s.Cols == nil {
Expand Down Expand Up @@ -410,6 +412,7 @@ func (s *Sheet) setCol(min, max int, setter func(col *Col)) {
}

// Set the width of a range of columns.
// Column numbers start from 1.
func (s *Sheet) SetColWidth(min, max int, width float64) {
s.mustBeOpen()
s.setCol(min, max, func(col *Col) {
Expand All @@ -425,6 +428,7 @@ func DefaultAutoWidth(s string) float64 {

// Tries to guess the best width for a column, based on the largest
// cell content. A scale function needs to be provided.
// Column numbers start from 1.
func (s *Sheet) SetColAutoWidth(colIndex int, width func(string) float64) error {
s.mustBeOpen()
largestWidth := 0.0
Expand Down

0 comments on commit 472402f

Please sign in to comment.