v2.7.0
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
GetCellStylefunction no longer return master cell style of the merge cell range - Rename 5 exported data types and error constant:
- Rename
PivotTableOptiontoPivotTableOptions - Rename
FormatHeaderFootertoHeaderFooterOptions - Rename
FormatSheetProtectiontoSheetProtectionOptions - Rename
SparklineOptiontoSparklineOptions - Rename
ErrExistsWorksheettoErrExistsSheet
- 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,ZeroHeightandZoomScale - Remove 2 exported constants:
OrientationPortraitandOrientationLandscape - Change 21 functions signature:
- Change the
func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) errortofunc (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error - Change the
func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) errortofunc (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error) - Change the
func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) errortofunc (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error - Change the
func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) errortofunc (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error) - Change the
func (f *File) GetSheetIndex(sheet string) inttofunc (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) booltofunc (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) inttofunc (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) errortofunc (f *File) AddChart(sheet, cell string, chart *ChartOptions, combo ...*ChartOptions) error - Change the
func (f *File) AddChartSheet(sheet, opts string, combo ...string) errortofunc (f *File) AddChartSheet(sheet string, chart *ChartOptions, combo ...*ChartOptions) error - Change the
func (f *File) AddShape(sheet, cell, opts string) errortofunc (f *File) AddShape(sheet, cell string, opts *Shape) error - Change the
func (f *File) AddPicture(sheet, cell, picture, format string) errortofunc (f *File) AddPicture(sheet, cell, picture string, opts *GraphicOptions) error - Change the
func (f *File) AddPictureFromBytes(sheet, cell, opts, name, extension string, file []byte) errortofunc (f *File) AddPictureFromBytes(sheet, cell, name, extension string, file []byte, opts *GraphicOptions) error - Change the
func (f *File) AddTable(sheet, hCell, vCell, opts string) errortofunc (f *File) AddTable(sheet, rangeRef string, opts *TableOptions) error - Change the
func (sw *StreamWriter) AddTable(hCell, vCell, opts string) errortofunc (sw *StreamWriter) AddTable(rangeRef string, opts *TableOptions) error - Change the
func (f *File) AutoFilter(sheet, hCell, vCell, opts string) errortofunc (f *File) AutoFilter(sheet, rangeRef string, opts *AutoFilterOptions) error - Change the
func (f *File) SetPanes(sheet, panes string) errortofunc (f *File) SetPanes(sheet string, panes *Panes) error - Change the
func (f *File) SetConditionalFormat(sheet, reference, opts string) errortofunc (f *File) SetConditionalFormat(sheet, rangeRef string, opts []ConditionalFormatOptions) error
- Change the
- Introduce new function to instead of existing functions:
- Use
SetSheetPropsinstead ofSetSheetPrOptionsandSetSheetFormatPr - Use
GetSheetPropsinstead ofGetSheetPrOptionsandGetSheetFormatPr - Use
SetSheetViewinstead ofSetSheetViewOptions - Use
GetSheetViewinstead ofGetSheetViewOptions - Use
SetWorkbookPropsinstead ofSetWorkbookPrOptions - Use
GetWorkbookPropsinstead ofGetWorkbookPrOptions - Use
InsertRowsinstead ofInsertRowfor support inserting multiple rows at once - Use
InsertColsinstead ofInsertColfor support inserting multiple columns at once
- Use
- Add
CellTypeFormula,CellTypeInlineString,CellTypeSharedStringand removeCellTypeStringinCellTypeenumeration - The parameter has been changed for the
AddCommentfunction, 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,GetDefaultFontandSetDefaultFontfunctions
Notable Features
- Add new functions
GetDataValidationsandGetConditionalFormatsfor get data validations and conditional formats, related issue #827 - Add new functions
ProtectWorkbookandUnprotectWorkbookfor workbook protection supports - Add new function
SetSheetColfor set worksheet column cells, related issue #1247 - Add new function
GetColStylefor get column styles, related issue #1293 - Add new function
SetSheetBackgroundFromBytesfor 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,ShapeParagraphandTableOptions - New support 2 formula functions: AGGREGATE and SUBTOTAL
- The
Save,WriteandWriteTofunction now accept saving options, related issue #744 - The
AddChartfunction support specify if smooth line of the line chart, related issue #1290 - The
AddChartfunction support set custom line color in the charts, related issue #1345 - The
AddChartfunction support custom chart axis font style, related issue #320 - The
AddChartfunction support create 3D line chart - The functions
SetColWidth,GetColWidth,SetColVisible,GetColVisible,SetColStyleandGetColStylenow 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
RowOptsfor 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,ErrSheetNameLengthandErrSheetNameSingleQuotehas 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
Closefunction now support cleanup stream writer temporary files - The
AddPicturefunction 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
ORfunction - 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
SetRowfunction, 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)