// SetColWidth provides a function to set the width of a single column or
// multiple columns. For example:
//
//    f := excelize.NewFile()
//    err := f.SetColWidth("Sheet1", "A", "H", 20)
//
762490
func (f *File) SetColWidth(sheet, startcol, endcol string, width float64) error {
	min, err := ColumnNameToNumber(startcol)
	if err != nil {
		return err
	}
	max, err := ColumnNameToNumber(endcol)
	if err != nil {
		return err
	}
	if min > max {
		min, max = max, min
	}

	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return err
	}
	col := xlsxCol{
		Min:         min,
		Max:         max,
		Width:       width,
		CustomWidth: true,
	}
	if xlsx.Cols != nil {
		xlsx.Cols.Col = append(xlsx.Cols.Col, col)
	} else {
		cols := xlsxCols{}
		cols.Col = append(cols.Col, col)
		xlsx.Cols = &cols
	}
	return err
}
505606
func (f *File) SetRowHeight(sheet string, row int, height float64) error {
	if row < 1 {
		return newInvalidRowNumberError(row)
	}

	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return err
	}

	prepareSheetXML(xlsx, 0, row)

	rowIdx := row - 1
	xlsx.SheetData.Row[rowIdx].Ht = height
	xlsx.SheetData.Row[rowIdx].CustomHeight = true
	return nil
}
266002
func (win *Window) LayoutSetWidth(width int) {
	layout := win.layout
	if layout.Row.Type != layoutStatic || len(layout.Row.WidthArr) > 0 {
		panic(WrongLayoutErr)
	}
	layout.Row.Index2++
	layout.Row.CalcMaxWidth = false
	layout.Row.ItemWidth = win.ctx.scale(width)
}
627338
func (window *Window) SetSize(w, h int32) {
	C.SDL_SetWindowSize(window.cptr(), C.int(w), C.int(h))
}
1284018
func (a *CreateTargetArgs) SetWidth(width int) *CreateTargetArgs {
	a.Width = &width
	return a
}
1009390
func (s *StorageDescriptor) SetColumns(v []*Column) *StorageDescriptor {
	s.Columns = v
	return s
}
444096
func (w *Window) SetSizeCallback(cbfun func(w *Window, width int, height int)) {
	if cbfun == nil {
		C.glfwSetWindowSizeCallback(w.data, nil)
	} else {
		w.fSizeHolder = cbfun
		C.glfwSetWindowSizeCallbackCB(w.data)
	}
}
523744
func (s *JobOutput) SetWidth(v int64) *JobOutput {
	s.Width = &v
	return s
}
689048
func (a *PrintToPDFArgs) SetPaperWidth(paperWidth float64) *PrintToPDFArgs {
	a.PaperWidth = &paperWidth
	return a
}
120717
func (f *File) GetColWidth(sheet, col string) (float64, error) {
	colNum, err := ColumnNameToNumber(col)
	if err != nil {
		return defaultColWidthPixels, err
	}
	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return defaultColWidthPixels, err
	}
	if xlsx.Cols != nil {
		var width float64
		for _, v := range xlsx.Cols.Col {
			if v.Min <= colNum && colNum <= v.Max {
				width = v.Width
			}
		}
		if width != 0 {
			return width, err
		}
	}
	// Optimisation for when the column widths haven't changed.
	return defaultColWidthPixels, err
}
832926
func (s *SourceTableDetails) SetTableSizeBytes(v int64) *SourceTableDetails {
	s.TableSizeBytes = &v
	return s
}
1155564
func (s *ResultSetMetadata) SetColumnMetadata(v []*ColumnMetadata) *ResultSetMetadata {
	s.ColumnMetadata = v
	return s
}
716489
func (p *WebPage) SetPaperSize(size PaperSize) error {
	req := map[string]interface{}{"ref": p.ref.id, "size": encodePaperSizeJSON(size)}
	return p.ref.process.doJSON("POST", "/webpage/SetPaperSize", req, nil)
}
2629
func (c *Condition) StringWidth(s string) (width int) {
	if c.ZeroWidthJoiner {
		return c.stringWidthZeroJoiner(s)
	}
	return c.stringWidth(s)
}
690751
func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) {
	if width < 0 {
		width = -1
	}
	emitter.best_width = width
}
309861
func (gp *GoPdf) SetLineWidth(width float64) {
	gp.curr.lineWidth = gp.UnitsToPoints(width)
	gp.getContent().AppendStreamSetLineWidth(gp.UnitsToPoints(width))
}
1018031
func (s *FecOutputSettings) SetRowLength(v int64) *FecOutputSettings {
	s.RowLength = &v
	return s
}