Commit Graph

154 Commits

Author SHA1 Message Date
yangyile-yyle88 5e500f5e5d
Introduce new exported PictureInsertType enumeration (#1864) 2024-03-27 15:50:51 +08:00
Matthew Sackman 838232fd27
Add support for get the Microsoft 365 cell images (#1857)
- Update unit tests
2024-03-26 23:19:23 +08:00
3zmx 50e23df865
ref #65, support _xlfn.ANCHORARRAY formula function (#1784)
- Initial formula array calculation support
- Update unit test and documentation
2024-01-18 15:31:43 +08:00
xuri 792656552b
This closes #1777, fix the GetStyle or GetConditionalStyle function to returns incorrect DecimalPlaces field value
- Update documentation for the NewStyle function
- Update unit tests
- Update dependencies Go module
- Update GitHub workflow dependencies package version
- Update copyright agreement statement
2024-01-09 20:56:20 +08:00
xuri 37e2d946be
Breaking changes: Go 1.18 and later required
- This made the GetPictureCell function support get embedded cell images
- Update dependencies module
- Update GitHub workflow
- Update documentation for the AddChart function
2023-12-19 23:39:45 +08:00
li 00d62590f4
This closes #664, support get embedded cell images (#1759)
Co-authored-by: liying05 <liying05@zhidemai.com>
2023-12-15 13:09:42 +08:00
Tajang 57faaf253a
Fix panic on GetPictureCells without drawing relationships parts (#1721) 2023-11-16 09:34:37 +08:00
Anton Petrov fe639faa45
This closes #1125, support update drawing objects on inserting/deleting columns/rows (#1127) 2023-11-06 09:51:19 +08:00
壹次心 27f1056929
This closes #1218 and closes #1689 (#1634)
- Introduce new exported function GetPictureCells
- Upgrade dependencies module golang.org/x/net from 0.16.0 to 0.17.0
- Update unit tests
2023-10-13 00:06:07 +08:00
xuri d133dc12d7
Support format cell value with fraction number format code
- Fix delete incorrect image files when picture deleting pictures
- Update the unit test and dependencies modules
2023-10-10 00:04:10 +08:00
xuri 87a00e4f7e
This closed #1680, fixing a potential issue that stream reader temporary files can not be clear
- Delete image files from the workbook internally when deleting pictures to reduce generated workbook size and resolve potential security issues
2023-10-09 00:14:56 +08:00
xuri 95fc35f46c
This fix #1682, removes table and content type parts when deleting the table
- Move worksheet-related functions in one place
2023-10-06 00:04:38 +08:00
xuri e3b7dad69a
Introduce the new exported function `AddSlicer` for adding table slicer
- Fix a v2.8.0 regression bug, generate workbook corruption caused by incorrect MRU colors style parts
- Fix corrupted workbooks generated when adding tables in some cases
- Added several exported extension list child element URI constants
- Move part of the internal constant and variables definition to the template source code file
- Updated unit tests
2023-09-16 12:21:11 +08:00
xuri ae64bcaabe
This fixes #1643, fixes #1647 and fixes #1653
- Correction cell type when formatting date type cell value
- Add check for MID and MIDB formula functions num_chars arguments, prevent panic on specifying a negative number
- Ref #65, add support for 2 formula functions: SEARCH and SEARCHB
- Fix a v2.8.0 regression bug, error on set print area and print titles with built-in special defined name
- Add new exported function `GetPivotTables` for get pivot tables
- Add a new `Name` field in the `PivotTableOptions` to support specify pivot table name
- Using relative cell reference in the pivot table docs and unit tests
- Support adding slicer content type part internally
- Add new exported source relationship and namespace `NameSpaceSpreadSheetXR10`, `ContentTypeSlicer`, `ContentTypeSlicerCache`, and `SourceRelationshipSlicer`
- Add new exported extended URI `ExtURIPivotCacheDefinition`
- Fix formula argument wildcard match issues
- Update GitHub Actions configuration, test on Go 1.21.x with 1.21.1 and later
- Avoid corrupted workbooks generated by improving compatibility with internally indexed color styles
2023-09-08 00:21:38 +08:00
xuri 15614badfc
This closes #1628, fix the GetPictures function returns pictures doesn't correct in some cases 2023-08-25 01:06:41 +08:00
xuri ae17fa87d5
This ref #1585, support to read one cell anchor pictures and improve date and time number format
- Support apply date and time number format with 16 languages: Persian, Polish, Portuguese, Punjabi, Quechua, Romanian, Romansh, Sakha, Sami, Sanskrit, Scottish Gaelic, Serbian, Sesotho sa Leboa, Setswana, Sindhi, Sinhala and Slovak
- Update the unit test and dependencies modules
2023-08-09 00:11:06 +08:00
xuri a07c8cd0b4
This closes #1588, closes #1591, breaking changes for the `AddChart` function
- Removed exported `ChartTitle` data type
- The `AddChart` function now supports formatting and setting rich text titles for the chart
- New exported function `GetFormControl` for getting form control
- Made case in-sensitive for internal worksheet XML path to improve compatibility
- Update the unit tests
- Update the documentation and internal comments on the codes
2023-07-28 00:24:08 +08:00
xuri 7f3d663628
This closes #1584, fix graphic object counter issues
- Optimize number format parser
- Update documentation for the `AddFormControl` function
- Update unit tests
- Upgrade dependencies package
2023-07-25 00:08:24 +08:00
xuri 8d996ca138
This closes #1582, fixes the formula calculation bug, and improves form controls
- Fix incorrect formula calculate results on a nested argument function which returns a numeric result
- Add a new exported error variable `ErrorFormControlValue`
- Rename exported enumeration `FormControlCheckbox` to `FormControlCheckBox`
- Rename exported enumeration `FormControlRadio` to `FormControlOptionButton`
- The `AddFormControl` function supports new 5 form controls: spin button, check box, group box, label, and scroll bar
- Update documentation for the `GraphicOptions` data type, `AddFormControl` and `NewStreamWriter` functions
- Update the unit tests
2023-07-21 00:03:37 +08:00
chengxinyao 9bc3fd7e9f
This optimize the code, simplify unit test and drawing object position calculation (#1561)
Co-authored-by: xinyao.cheng <xinyao.cheng@zerone.com.cn>
2023-06-14 22:49:40 +08:00
壹次心 e3fb2d7bad
This closes #1548, support to get multiple images in one cell (#1549) 2023-05-28 00:46:34 +08:00
xuri 612f6f104c
This closes #1528, closes #1533
- Avoid format text cell value as a numeric
- Fix race conditions for concurrency safety functions
2023-04-25 08:44:41 +08:00
xuri 93c72b4d55
This optimizes internal functions signature and mutex declarations 2023-04-24 00:02:13 +08:00
playGitboy 5878fbd282
This closes #1503, case-insensitive for the file extension name 2023-03-23 00:06:10 +08:00
xuri 478b528af1
Breaking changes: changed the function signature for 2 exported functions
- Change
    `func (f *File) AddPictureFromBytes(sheet, cell, name, extension string, file []byte, opts *GraphicOptions) error`
    to
    `func (f *File) AddPictureFromBytes(sheet, cell string, pic *Picture) error`
- Change
    `func (f *File) GetPicture(sheet, cell string) (string, []byte, error)`
    to
    `func (f *File) GetPictures(sheet, cell string) ([]Picture, error)`

Co-authored-by: huangsk <645636204@qq.com>
2023-03-19 20:29:35 +08:00
xuri 363fa940ac
This closes #1468, checks the table name, and added a new error constant `ErrTableNameLength`
- XML Structure field typo fixed
- Update documentation for the `AddChart` function
- Update unit test
2023-02-13 13:28:02 +08:00
xuri 1f69f6b24a
Add support for insert BMP format images
- Add support for workbook function groups
- Update code and docs for the build-in currency number format
- Update unit tests
2023-02-05 01:30:38 +08:00
xuri b39626fae9
This fixed worksheet protection issue
- Update example code in the documentation
- Update unit tests
- Rename `PictureOptions` to `GraphicOptions`
- Adjust partial options fields data types for the `PictureOptions` and `Shape` structure
- Update dependencies module
2023-01-02 11:47:31 +08:00
xuri f58dabd492
Breaking change: changed the function signature for 11 exported functions
* Change
    `func (f *File) NewConditionalStyle(style string) (int, error)`
    to
    `func (f *File) NewConditionalStyle(style *Style) (int, error)`
* Change
    `func (f *File) NewStyle(style interface{}) (int, error)`
     to
    `func (f *File) NewStyle(style *Style) (int, error)`
* Change
    `func (f *File) AddChart(sheet, cell, opts string, combo ...string) error`
     to
    `func (f *File) AddChart(sheet, cell string, chart *ChartOptions, combo ...*ChartOptions) error`
* Change
    `func (f *File) AddChartSheet(sheet, opts string, combo ...string) error`
     to
    `func (f *File) AddChartSheet(sheet string, chart *ChartOptions, combo ...*ChartOptions) error`
* Change
    `func (f *File) AddShape(sheet, cell, opts string) error`
     to
    `func (f *File) AddShape(sheet, cell string, opts *Shape) error`
* Change
    `func (f *File) AddPictureFromBytes(sheet, cell, opts, name, extension string, file []byte) error`
     to
    `func (f *File) AddPictureFromBytes(sheet, cell, name, extension string, file []byte, opts *PictureOptions) error`
* Change
    `func (f *File) AddTable(sheet, hCell, vCell, opts string) error`
     to
    `func (f *File) AddTable(sheet, reference string, opts *TableOptions) error`
* Change
    `func (sw *StreamWriter) AddTable(hCell, vCell, opts string) error`
     to
    `func (sw *StreamWriter) AddTable(reference string, opts *TableOptions) error`
* Change
    `func (f *File) AutoFilter(sheet, hCell, vCell, opts string) error`
     to
    `func (f *File) AutoFilter(sheet, reference string, opts *AutoFilterOptions) error`
* Change
    `func (f *File) SetPanes(sheet, panes string) error`
     to
    `func (f *File) SetPanes(sheet string, panes *Panes) error`
* Change
    `func (sw *StreamWriter) AddTable(hCell, vCell, opts string) error`
     to
    `func (sw *StreamWriter) AddTable(reference string, opts *TableOptions) error`
* Change
    `func (f *File) SetConditionalFormat(sheet, reference, opts string) error`
     to
    `func (f *File) SetConditionalFormat(sheet, reference string, opts []ConditionalFormatOptions) error`
* Add exported types:
  * AutoFilterListOptions
  * AutoFilterOptions
  * Chart
  * ChartAxis
  * ChartDimension
  * ChartLegend
  * ChartLine
  * ChartMarker
  * ChartPlotArea
  * ChartSeries
  * ChartTitle
  * ConditionalFormatOptions
  * PaneOptions
  * Panes
  * PictureOptions
  * Shape
  * ShapeColor
  * ShapeLine
  * ShapeParagraph
  * TableOptions
* This added support for set sheet visible as very hidden
* Return error when missing required parameters for set defined name
* Update unit test and comments
2022-12-30 00:50:08 +08:00
jianxinhou 5e0953d778
This closes #1405, add new function SetSheetBackgroundFromBytes (#1406)
Co-authored-by: houjianxin.rupert <houjianxin.rupert@bytedance.com>
2022-12-01 10:44:28 +08:00
xuri c0713951c8
This closes #1404, fixes the insert picture problem in some cases
- Updates unit tests
- Updates documentation for stream mode functions
- Updates hyperlinks in the documentation
2022-11-29 00:03:49 +08:00
xuri ac564afa56
Remove internal error log print, throw XML deserialize error 2022-11-13 00:40:04 +08:00
xuri bd5dd17673
This is a breaking change, remove partial internal error log print, throw XML deserialize error
- Add error return value for the `GetComments`, `GetDefaultFont` and `SetDefaultFont` functions
- Update unit tests
2022-11-12 00:16:23 +08:00
xuri db2d084ada
This closes #1204, breaking changes for add comments
- Allowing insert SVG format images
- Unit tests updated
2022-11-02 08:45:06 +08:00
xuri 7363c1e333
Go 1.16 and later required, migration of deprecation package `ioutil`
- Improving performance for stream writer `SetRow` function,  reduces memory usage over and speedup about 19%
- Update dependencies module
- Update GitHub workflow
2022-10-13 00:13:36 +08:00
xuri 53a495563a
This closes #1358, made a refactor with breaking changes, see details:
This made a refactor with breaking changes:

Motivation and Context

When I decided to add set horizontal centered support for this library to resolve #1358, the reason I made this huge breaking change was:

- There are too many exported types for set sheet view, properties, and format properties, although a function using the functional options pattern can be optimized by returning an anonymous function, these types or property set or get function has no binding categorization, so I change these functions like `SetAppProps` to accept a pointer of options structure.
- Users can not easily find out which properties should be in the `SetSheetPrOptions` or `SetSheetFormatPr` categories
- Nested properties cannot proceed modify easily

Introduce 5 new export data types:
`HeaderFooterOptions`, `PageLayoutMarginsOptions`, `PageLayoutOptions`, `SheetPropsOptions`, and `ViewOptions`

Rename 4 exported data types:
- Rename `PivotTableOption` to `PivotTableOptions`
- Rename `FormatHeaderFooter` to `HeaderFooterOptions`
- Rename `FormatSheetProtection` to `SheetProtectionOptions`
- Rename `SparklineOption` to `SparklineOptions`

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` and `ZoomScale`

Remove 2 exported constants:
`OrientationPortrait` and `OrientationLandscape`

Change 8 functions:
- Change the `func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error` to `func (f *File) SetPageLayout(sheet string, opts *PageLayoutOptions) error`
- Change the `func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error` to `func (f *File) GetPageLayout(sheet string) (PageLayoutOptions, error)`
- Change the `func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error` to `func (f *File) SetPageMargins(sheet string, opts *PageLayoutMarginsOptions) error`
- Change the `func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error` to `func (f *File) GetPageMargins(sheet string) (PageLayoutMarginsOptions, error)`
- Change the `func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error` to `func (f *File) SetSheetView(sheet string, viewIndex int, opts *ViewOptions) error`
- Change the `func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error` to `func (f *File) GetSheetView(sheet string, viewIndex int) (ViewOptions, error)`
- Change the `func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error` to `func (f *File) SetWorkbookProps(opts *WorkbookPropsOptions) error`
- Change the `func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error` to `func (f *File) GetWorkbookProps() (WorkbookPropsOptions, error)`

Introduce new function to instead of existing functions:
- New function `func (f *File) SetSheetProps(sheet string, opts *SheetPropsOptions) error` instead of `func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error` and `func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOption
2022-09-29 22:04:50 +08:00
xuri efcf599dfe
This closes #1360, closes #1361
- Fix default number format parse issue with a long string of digits
- Fix creating a sheet with an empty name cause a corrupted file
- The `GetCellStyle` function no longer return master cell style of the merge cell range
- Using the specialized name in variables and functions
2022-09-28 00:04:17 +08:00
xuri 3f702999e6
Using the specialized name in a variable and making comments clear
- Add JSON tags for `AppProperties`, `PivotTableOption` and `PivotTableField` structure
2022-09-18 00:07:15 +08:00
xuri b6cc43d824
This makes 6 functions concurrency safety
- These 6 functions now support concurrency safe: SetColWidth, GetColWidth, SetColVisible, GetColVisible, SetColStyle and GetColStyle
2022-09-11 00:04:04 +08:00
xuri 961a3e8933
Fix get image content was empty after inserting image 2022-09-06 14:38:09 +08:00
xuri ab12307393
This made library allowing insert EMZ and WMZ format image
- Update dependencies module
2022-08-21 01:09:32 +08:00
NaturalGao 76f336809f
This closes #849, add new function `DeleteComment` for delete comment (#1317)
- Update unit tests for the delete comment
- Add 3 errors function for error messages
2022-08-19 23:24:13 +08:00
xuri 551fb8a9e4
This closes #1244 and closes #1314, improving the compatibility with Google Sheet
- Format code with `gofmt`
2022-08-13 11:21:59 +08:00
xuri ebea684ae5
Fix potential file corrupted and change worksheet name case-insensitive
- Using sheet ID instead of sheet index when delete the cell in calculation chain
- Update documentation for exported functions
- Using `sheet` represent the sheet name in the function parameters
2022-07-18 00:21:34 +08:00
Eng Zer Jun 6bcf5e4ede
refactor: replace strings.Replace with strings.ReplaceAll (#1250)
strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-06-12 00:19:12 +08:00
xuri 8f16a76781
This fixes a part of staticcheck issues and updates the code of conduct
Update example for set cell hyperlinks with `HyperlinkOpts`
2022-05-18 23:15:24 +08:00
xuri c2311ce87d
This made library allowing insert WMF format image 2022-05-14 00:54:36 +08:00
xuri 0c3fd0223c
This closes #1225, allowing insert EMF format images 2022-05-13 01:03:40 +08:00
xuri 856ee57c40
This closes #1212, init support for 1900 or 1904 date system 2022-04-30 09:54:11 +08:00
xuri 6fa950a4f8
ref #65, new formula functions: SKEW.P and SLOPE, remove no-required format default 2022-04-16 13:53:16 +08:00