excelize/errors.go

109 lines
5.0 KiB
Go
Raw Normal View History

// Copyright 2016 - 2021 The excelize Authors. All rights reserved. Use of
2019-03-20 15:13:41 +08:00
// this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
//
// Package excelize providing a set of functions that allow you to write to
2020-06-22 00:14:56 +08:00
// and read from XLSX / XLSM / XLTM files. Supports reading and writing
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports
2020-06-22 00:14:56 +08:00
// complex components by high compatibility, and provided streaming API for
// generating or reading data from a worksheet with huge amounts of data. This
// library needs Go version 1.15 or later.
2019-03-20 15:13:41 +08:00
package excelize
import (
"errors"
"fmt"
)
func newInvalidColumnNameError(col string) error {
return fmt.Errorf("invalid column name %q", col)
}
func newInvalidRowNumberError(row int) error {
return fmt.Errorf("invalid row number %d", row)
}
func newInvalidCellNameError(cell string) error {
return fmt.Errorf("invalid cell name %q", cell)
}
func newInvalidExcelDateError(dateValue float64) error {
return fmt.Errorf("invalid date value %f, negative values are not supported supported", dateValue)
}
func newUnsupportChartType(chartType string) error {
return fmt.Errorf("unsupported chart type %s", chartType)
}
var (
// ErrStreamSetColWidth defined the error message on set column width in
// stream writing mode.
ErrStreamSetColWidth = errors.New("must call the SetColWidth function before the SetRow function")
// ErrColumnNumber defined the error message on receive an invalid column
// number.
ErrColumnNumber = errors.New("column number exceeds maximum limit")
// ErrColumnWidth defined the error message on receive an invalid column
// width.
ErrColumnWidth = errors.New("the width of the column must be smaller than or equal to 255 characters")
// ErrOutlineLevel defined the error message on receive an invalid outline
// level number.
ErrOutlineLevel = errors.New("invalid outline level")
// ErrCoordinates defined the error message on invalid coordinates tuples
// length.
ErrCoordinates = errors.New("coordinates length must be 4")
// ErrExistsWorksheet defined the error message on given worksheet already
// exists.
ErrExistsWorksheet = errors.New("the same name worksheet already exists")
// ErrTotalSheetHyperlinks defined the error message on hyperlinks count
// overflow.
ErrTotalSheetHyperlinks = errors.New("over maximum limit hyperlinks in a worksheet")
// ErrInvalidFormula defined the error message on receive an invalid
// formula.
ErrInvalidFormula = errors.New("formula not valid")
// ErrAddVBAProject defined the error message on add the VBA project in
// the workbook.
ErrAddVBAProject = errors.New("unsupported VBA project extension")
// ErrToExcelTime defined the error message on receive a not UTC time.
ErrToExcelTime = errors.New("only UTC time expected")
// ErrMaxRowHeight defined the error message on receive an invalid row
// height.
ErrMaxRowHeight = errors.New("the height of the row must be smaller than or equal to 409 points")
// ErrImgExt defined the error message on receive an unsupported image
// extension.
ErrImgExt = errors.New("unsupported image extension")
// ErrMaxFileNameLength defined the error message on receive the file name
// length overflow.
ErrMaxFileNameLength = errors.New("file name length exceeds maximum limit")
// ErrEncrypt defined the error message on encryption spreadsheet.
ErrEncrypt = errors.New("not support encryption currently")
// ErrUnknownEncryptMechanism defined the error message on unsupport
// encryption mechanism.
ErrUnknownEncryptMechanism = errors.New("unknown encryption mechanism")
// ErrUnsupportEncryptMechanism defined the error message on unsupport
// encryption mechanism.
ErrUnsupportEncryptMechanism = errors.New("unsupport encryption mechanism")
// ErrParameterRequired defined the error message on receive the empty
// parameter.
ErrParameterRequired = errors.New("parameter is required")
// ErrParameterInvalid defined the error message on receive the invalid
// parameter.
ErrParameterInvalid = errors.New("parameter is invalid")
// ErrDefinedNameScope defined the error message on not found defined name
// in the given scope.
ErrDefinedNameScope = errors.New("no defined name on the scope")
// ErrDefinedNameduplicate defined the error message on the same name
// already exists on the scope.
ErrDefinedNameduplicate = errors.New("the same name already exists on the scope")
// ErrFontLength defined the error message on the length of the font
// family name overflow.
ErrFontLength = errors.New("the length of the font family name must be smaller than or equal to 31")
// ErrFontSize defined the error message on the size of the font is invalid.
ErrFontSize = errors.New("font size must be between 1 and 409 points")
// ErrSheetIdx defined the error message on receive the invalid worksheet
// index.
ErrSheetIdx = errors.New("invalid worksheet index")
// ErrGroupSheets defined the error message on group sheets.
ErrGroupSheets = errors.New("group worksheet must contain an active worksheet")
)