We are pleased to announce the release of version 2.7.0. Featured are a handful of new areas of functionality and numerous bug fixes.
A summary of changes is available in the Release Notes. A full list of changes is available in the changelog.
Release Notes
The most notable changes in this release are:
Breaking Change
- Upgrade requirements Go language version is 1.16 or later, for migration of deprecation package
ioutil
- Checking and return error for invalid sheet name instead of trim invalid characters
- The
GetCellStyle
function no longer return master cell style of the merge cell range - Rename 5 exported data types and error constant:
- Rename
PivotTableOption
toPivotTableOptions
- Rename
FormatHeaderFooter
toHeaderFooterOptions
- Rename
FormatSheetProtection
toSheetProtectionOptions
- Rename
SparklineOption
toSparklineOptions
- Rename
ErrExistsWorksheet
toErrExistsSheet
- Rename
- Remove 54 exported types:
AutoPageBreaks
,BaseColWidth
,BlackAndWhite
,CodeName
,CustomHeight
,Date1904
,DefaultColWidth
,DefaultGridColor
,DefaultRowHeight
,EnableFormatConditionsCalculation
,FilterPrivacy
,FirstPageNumber
,FitToHeight
,FitToPage
,FitToWidth
,OutlineSummaryBelow
,PageLayoutOption
,PageLayoutOptionPtr
,PageLayoutOrientation
,PageLayoutPaperSize
,PageLayoutScale
,PageMarginBottom
,PageMarginFooter
,PageMarginHeader
,PageMarginLeft
,PageMarginRight
,PageMarginsOptions
,PageMarginsOptionsPtr
,PageMarginTop
,Published
,RightToLeft
,SheetFormatPrOptions
,SheetFormatPrOptionsPtr
,SheetPrOption
,SheetPrOptionPtr
,SheetViewOption
,SheetViewOptionPtr
,ShowFormulas
,ShowGridLines
,ShowRowColHeaders
,ShowRuler
,ShowZeros
,TabColorIndexed
,TabColorRGB
,TabColorTheme
,TabColorTint
,ThickBottom
,ThickTop
,TopLeftCell
,View
,WorkbookPrOption
,WorkbookPrOptionPtr
,ZeroHeight
andZoomScale
- Remove 2 exported constants:
OrientationPortrait
andOrientationLandscape
- Change 21 functions signature:
- Change the
func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error
tofunc (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error
- Change the
func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error
tofunc (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)
- Change the
func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error
tofunc (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error
- Change the
func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error
tofunc (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)
- Change the
func (f *File) GetSheetIndex(sheet string) int
tofunc (f *File) GetSheetIndex(sheet string) (int, error)
- Change the
func (f *File) SetSheetName(source, target string)
tofunc (f *File) SetSheetName(source, target string) error
- Change the
func (f *File) GetSheetVisible(sheet string)
tofunc (f *File) GetSheetVisible(sheet string) (bool, error)
- Change the
func (f *File) DeleteSheet(sheet string)
tofunc (f *File) DeleteSheet(sheet string) error
- Change the
func (f *File) NewSheet(sheet string) int
tofunc (f *File) NewSheet(sheet string) (int, error)
- Change the
func (f *File) NewConditionalStyle(style string) (int, error)
tofunc (f *File) NewConditionalStyle(style *Style) (int, error)
- Change the
func (f *File) NewStyle(style interface{}) (int, error)
tofunc (f *File) NewStyle(style *Style) (int, error)
- Change the
func (f *File) AddChart(sheet, cell, opts string, combo ...string) error
tofunc (f *File) AddChart(sheet, cell string, chart *ChartOptions, combo ...*ChartOptions) error
- Change the
func (f *File) AddChartSheet(sheet, opts string, combo ...string) error
tofunc (f *File) AddChartSheet(sheet string, chart *ChartOptions, combo ...*ChartOptions) error
- Change the
func (f *File) AddShape(sheet, cell, opts string) error
tofunc (f *File) AddShape(sheet, cell string, opts *Shape) error
- Change the
func (f *File) AddPicture(sheet, cell, picture, format string) error
tofunc (f *File) AddPicture(sheet, cell, picture string, opts *GraphicOptions) error
- Change the
func (f *File) AddPictureFromBytes(sheet, cell, opts, name, extension string, file []byte) error
tofunc (f *File) AddPictureFromBytes(sheet, cell, name, extension string, file []byte, opts *GraphicOptions) error
- Change the
func (f *File) AddTable(sheet, hCell, vCell, opts string) error
tofunc (f *File) AddTable(sheet, rangeRef string, opts *TableOptions) error
- Change the
func (sw *StreamWriter) AddTable(hCell, vCell, opts string) error
tofunc (sw *StreamWriter) AddTable(rangeRef string, opts *TableOptions) error
- Change the
func (f *File) AutoFilter(sheet, hCell, vCell, opts string) error
tofunc (f *File) AutoFilter(sheet, rangeRef string, opts *AutoFilterOptions) error
- Change the
func (f *File) SetPanes(sheet, panes string) error
tofunc (f *File) SetPanes(sheet string, panes *Panes) error
- Change the
func (f *File) SetConditionalFormat(sheet, reference, opts string) error
tofunc (f *File) SetConditionalFormat(sheet, rangeRef string, opts []ConditionalFormatOptions) error
- Change the
- Introduce new function to instead of existing functions:
- Use
SetSheetProps
instead ofSetSheetPrOptions
andSetSheetFormatPr
- Use
GetSheetProps
instead ofGetSheetPrOptions
andGetSheetFormatPr
- Use
SetSheetView
instead ofSetSheetViewOptions
- Use
GetSheetView
instead ofGetSheetViewOptions
- Use
SetWorkbookProps
instead ofSetWorkbookPrOptions
- Use
GetWorkbookProps
instead ofGetWorkbookPrOptions
- Use
InsertRows
instead ofInsertRow
for support inserting multiple rows at once - Use
InsertCols
instead ofInsertCol
for support inserting multiple columns at once
- Use
- Add
CellTypeFormula
,CellTypeInlineString
,CellTypeSharedString
and removeCellTypeString
inCellType
enumeration - The parameter has been changed for the
AddComment
function, support create rich-text in comments, related issue #1204 - Remove internal error log print, an error will be returned when XML deserialize error, add error return value for the
GetComments
,GetDefaultFont
andSetDefaultFont
functions
Notable Features
- Add new functions
GetDataValidations
andGetConditionalFormats
for get data validations and conditional formats, related issue #827 - Add new functions
ProtectWorkbook
andUnprotectWorkbook
for workbook protection supports - Add new function
SetSheetCol
for set worksheet column cells, related issue #1247 - Add new function
GetColStyle
for set column styles, related issue #1293 - Add new function
SetSheetBackgroundFromBytes
for set background picture by given image data, related issue #1405 - Add new export variable
IndexedColorMapping
- Add 20 export types:
AutoFilterListOptions
,AutoFilterOptions
,Chart
,ChartAxis
,ChartDimension
,ChartLegend
,ChartLine
,ChartMarker
,ChartPlotArea
,ChartSeries
,ChartTitle
,ConditionalFormatOptions
,PaneOptions
,Panes
,GraphicOptions
,Shape
,ShapeColor
,ShapeLine
,ShapeParagraph
andTableOptions
- New support 2 formula functions: AGGREGATE and SUBTOTAL
- The
Save
,Write
andWriteTo
function now accept saving options, related issue #744 - The
AddChart
function support specify if smooth line of the line chart, related issue #1290 - The
AddChart
function support set custom line color in the charts, related issue #1345 - The
AddChart
function support custom chart axis font style, related issue #320 - The
AddChart
function support create 3D line chart - The functions
SetColWidth
,GetColWidth
,SetColVisible
,GetColVisible
,SetColStyle
andGetColStyle
now support concurrency safe - An error will be returned when set the not exist style ID, related issue #1323
- An error will be returned when setting the stream row without ascending row numbers, to avoid potential mistakes, related issue #1139
- The stream writer will be apply style in
RowOpts
for each cell, related issue #1354 - The stream writer support to set panes, related issue #1047
- The stream writer support to set inline rich text cell
- The stream writer support to insert the page break
- New 7 exported errors:
ErrUnprotectWorkbook
,ErrUnprotectWorkbookPassword
,ErrStreamSetPanes
,ErrSheetNameBlank
,ErrSheetNameInvalid
,ErrSheetNameLength
andErrSheetNameSingleQuote
has been added - Introduce 5 new export data types:
HeaderFooterOptions
,PageLayoutMarginsOptions
,PageLayoutOptions
,SheetPropsOptions
, andViewOptions
- Support to set summary columns to appear to the right of detail in an outline
- Support to set and get font color with theme and tint, related issue #1369
- Support get cell value which contains a date in the ISO 8601 format
- Support set and get font color with indexed color
- Support update column style when inserting or deleting columns
- The workbook
Close
function now support cleanup stream writer temporary files - The
AddPicture
function now allowing insert SVG format images
Improve the Compatibility
- Stream writer writes inline string type for string cell value, related issue #1377
- Skip empty rows when saving the spreadsheet to reduce file size, related issue #1383
Bug Fixes
- Fix decimal number format round issue with build-in number format, resolve issue #1328, #1368 and #1373
- Fix apply AM/PM number format issue in some case, resolve issue #1338
- Fix the panic when delete comments caused by slice bounds out of range, resolve issue #1343
- Fix the panic when get cell value in some case, resolve issue #1384 and #1415
- Fix default number format parse issue with a long string of digits, resolve issue #1360
- Fix creating a sheet with an empty name cause a corrupted file, resolve issue #1361
- Fix get image content was empty after inserting image
- Fix generate workbook corruption after insert columns/rows in some case
- Delete shared formula in calc chain when writing a formula cell, to fix generate workbook corruption in some case
- Normalize the sheet name to fix behavior regression between 2.6.0 & 2.6.1, resolve issue #1365
- Fix the formula calculation result issue of the
OR
function - Fix error on inserting columns or rows on the worksheet which contains one cell merged cell range
- Fix error on getting the range of merged cells on the worksheet which contains one cell merged cell range
- Fix getting incomplete rich text cell value in some cases
- Escape XML characters for stream writer to avoid with corrupt file, resolve issue #1391
- Fix formula function ADDRESS result error with empty worksheet name, resolve issue #1396
- Fix insert picture problem in some cases, resolve issue #1404
Performance
- Improve performance for stream writer merging cells, time cost decrease over 90% and reduce memory usage by about 86% at most
- Improving performance for stream writer
SetRow
function, reduces memory usage over and speedup about 19%
Miscellaneous
- The dependencies module has been updated
- Unit tests and godoc updated
- Using the specialized name in variables and functions
- Documentation website with multilingual: Arabic, German, Spanish, English, French, Russian, Chinese, Japanese, and Korean, which has been updated
Thank you
Thanks for all the contributors to Excelize. Below is a list of contributors that have code contributions in this version:
- @cdenicola (Cooper de Nicola)
- @chenliu1993
- @davidborry
- @patsak (Kostya Privezentsev)
- @dafengge0913
- @Beeb0p (Artem Tarasenko)
- @invzhi
- @zhangzitao (Zitao)
- @jtwatson (Joseph Watson)
- @carbin-gun (charles.deng)
- @harrison3000 (Harrison)
- @strivek (GaoFei)
- @gonghaibinx
- @martinmr (Martin Martinez Rivera)
- @zclark (Zach Clark)
- @March0715 (March)
- @renxiaotu
- @devloppper
- @jianxinhou
- @nesstord
- @Bayzet (Bayzet Tlyupov)
- @guoweikuang (郭伟匡)
- @qinyuguang (Gin)
- @liron-l (Liron Levin)