qax-os/excelize · error

the height of the row must be less than or equal to %d point

Error message

the height of the row must be less than or equal to %d points

What it means

ErrMaxRowHeight is returned when a row height value passed to SetRowHeight exceeds MaxRowHeight points, the OOXML/Excel maximum for row height. Excelize validates the height in rows.go before writing it to the worksheet, so oversized values never reach the file. Heights above the cap would otherwise produce a corrupt or non-conformant sheet.

Source

Thrown at errors.go:99

	// ErrFontSize defined the error message on the size of the font is invalid.
	ErrFontSize = fmt.Errorf("font size must be an integer from %d to %d points", MinFontSize, MaxFontSize)
	// ErrFormControlValue defined the error message for receiving a scroll
	// value exceeds limit.
	ErrFormControlValue = fmt.Errorf("scroll value must be an integer from 0 to %d", MaxFormControlValue)
	// ErrGroupSheets defined the error message on group sheets.
	ErrGroupSheets = errors.New("group worksheet must contain an active worksheet")
	// ErrImgExt defined the error message on receive an unsupported image
	// extension.
	ErrImgExt = errors.New("unsupported image extension")
	// ErrInvalidFormula defined the error message on receive an invalid
	// formula.
	ErrInvalidFormula = errors.New("formula not valid")
	// ErrMaxFilePathLength defined the error message on receive the file path
	// length overflow.
	ErrMaxFilePathLength = fmt.Errorf("file path length exceeds maximum limit %d characters", MaxFilePathLength)
	// ErrMaxRowHeight defined the error message on receive an invalid row
	// height.
	ErrMaxRowHeight = fmt.Errorf("the height of the row must be less than or equal to %d points", MaxRowHeight)
	// ErrMaxRows defined the error message on receive a row number exceeds
	// maximum limit.
	ErrMaxRows = errors.New("row number exceeds maximum limit")
	// ErrNameLength defined the error message on receiving the defined name or
	// table name length exceeds the limit.
	ErrNameLength = fmt.Errorf("the name length exceeds the %d characters limit", MaxFieldLength)
	// ErrMaxGraphicAltTextLength defined the error message on receiving the
	// graphic alt text length exceeds the limit.
	ErrMaxGraphicAltTextLength = fmt.Errorf("the alt text length exceeds the %d characters limit", MaxGraphicAltTextLength)
	// ErrMaxGraphicNameLength defined the error message on receiving the
	// graphic name length exceeds the limit.
	ErrMaxGraphicNameLength = fmt.Errorf("the name length exceeds the %d characters limit", MaxGraphicNameLength)
	// ErrOptionsUnzipSizeLimit defined the error message for receiving
	// invalid UnzipSizeLimit and UnzipXMLSizeLimit.
	ErrOptionsUnzipSizeLimit = errors.New("the value of UnzipSizeLimit should be greater than or equal to UnzipXMLSizeLimit")
	// ErrOutlineLevel defined the error message on receive an invalid outline
	// level number.
	ErrOutlineLevel = errors.New("invalid outline level")

View on GitHub (pinned to f2483381fb)

Solutions

  1. Clamp the height to MaxRowHeight before calling SetRowHeight (e.g. math.Min(height, MaxRowHeight))
  2. Check the computed value with TestRowHeight first if you want a non-failing probe
  3. If auto-fitting text, cap the value at MaxRowHeight and consider splitting content across multiple rows instead

Example fix

// before
err := f.SetRowHeight("Sheet1", 4, computedHeight)
// after
if computedHeight > excelize.MaxRowHeight {
	computedHeight = excelize.MaxRowHeight
}
err := f.SetRowHeight("Sheet1", 4, computedHeight)
Defensive patterns

Strategy: validation

Validate before calling

func validRowHeight(h float64) bool { return h <= excelize.MaxRowHeight }

Type guard

if h > excelize.MaxRowHeight { h = excelize.MaxRowHeight }

Prevention

When it happens

Trigger: Calling f.SetRowHeight(sheet, row, height) or TestRowHeight with height > MaxRowHeight (409 points); also triggered indirectly via marshalAttrs and TestStreamWriter when a stored height is out of range.

Common situations: Auto-sizing rows by computing pixel/point heights from long wrapped text and forgetting the cap; porting code from HTML/PDF layouts that use larger units; importing heights from other formats without clamping.

Related errors


AI-assisted analysis of qax-os/excelize@f2483381fb (2026-09-02). Data as JSON: /api/errors/46d968bc431d1041. Report an issue: GitHub.