From be12cc27f1d774154b17763c071e1dc6f91eab8c Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 10 May 2021 00:09:24 +0800 Subject: This closes #652, new SetColWidth API, support set column width in stream writing mode, and export error message --- errors.go | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'errors.go') diff --git a/errors.go b/errors.go index 0ab2642..a0c61c8 100644 --- a/errors.go +++ b/errors.go @@ -11,7 +11,10 @@ package excelize -import "fmt" +import ( + "errors" + "fmt" +) func newInvalidColumnNameError(col string) error { return fmt.Errorf("invalid column name %q", col) @@ -28,3 +31,44 @@ func newInvalidCellNameError(cell string) error { func newInvalidExcelDateError(dateValue float64) error { return fmt.Errorf("invalid date value %f, negative values are not supported supported", dateValue) } + +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") +) -- cgit v1.2.1