Commit Graph

26 Commits

Author SHA1 Message Date
xuri 65a53b3ec6
Breaking changes: replace the type `ShapeParagraph` with `RichTextRun`
- This removes the `Color` field from the type `Shape`, and uses the `Fill` instead of it
- Remove sharp symbol from hex RGB color
- Update unit tests
2023-02-27 00:05:36 +08:00
xuri 3e2406096f
This closes #1462 and closes #1464
- Support creating a conditional format with a "stop if true" rule
- Support set border color and create solid color for the color data bar
- Fix incorrect cell type when modifying string cell with the time number
- Update unit test for the add pivot table to avoid pivot table range overlap
2023-02-07 00:08:11 +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
郭伟匡 6a5ee811ba
This closes #1425, breaking changes for sheet name (#1426)
- Checking and return error for invalid sheet name instead of trim invalid characters
- Add error return for the 4 functions: `DeleteSheet`, `GetSheetIndex`, `GetSheetVisible` and `SetSheetName`
- Export new error 4 constants: `ErrSheetNameBlank`, `ErrSheetNameInvalid`, `ErrSheetNameLength` and `ErrSheetNameSingleQuote`
- Rename exported error constant `ErrExistsWorksheet` to `ErrExistsSheet`
- Update unit tests for 90 functions: `AddChart`,  `AddChartSheet`, `AddComment`, `AddDataValidation`, `AddPicture`, `AddPictureFromBytes`, `AddPivotTable`, `AddShape`, `AddSparkline`, `AddTable`, `AutoFilter`, `CalcCellValue`, `Cols`, `DeleteChart`, `DeleteComment`, `DeleteDataValidation`, `DeletePicture`, `DeleteSheet`, `DuplicateRow`, `DuplicateRowTo`, `GetCellFormula`, `GetCellHyperLink`, `GetCellRichText`, `GetCellStyle`, `GetCellType`, `GetCellValue`, `GetColOutlineLevel`, `GetCols`, `GetColStyle`, `GetColVisible`, `GetColWidth`, `GetConditionalFormats`, `GetDataValidations`, `GetMergeCells`, `GetPageLayout`, `GetPageMargins`, `GetPicture`, `GetRowHeight`, `GetRowOutlineLevel`, `GetRows`, `GetRowVisible`, `GetSheetIndex`, `GetSheetProps`, `GetSheetVisible`, `GroupSheets`, `InsertCol`, `InsertPageBreak`, `InsertRows`, `MergeCell`, `NewSheet`, `NewStreamWriter`, `ProtectSheet`, `RemoveCol`, `RemovePageBreak`, `RemoveRow`, `Rows`, `SearchSheet`, `SetCellBool`, `SetCellDefault`, `SetCellFloat`, `SetCellFormula`, `SetCellHyperLink`, `SetCellInt`, `SetCellRichText`, `SetCellStr`, `SetCellStyle`, `SetCellValue`, `SetColOutlineLevel`, `SetColStyle`, `SetColVisible`, `SetColWidth`, `SetConditionalFormat`, `SetHeaderFooter`, `SetPageLayout`, `SetPageMargins`, `SetPanes`, `SetRowHeight`, `SetRowOutlineLevel`, `SetRowStyle`, `SetRowVisible`, `SetSheetBackground`, `SetSheetBackgroundFromBytes`, `SetSheetCol`, `SetSheetName`, `SetSheetProps`, `SetSheetRow`, `SetSheetVisible`, `UnmergeCell`, `UnprotectSheet` and
`UnsetConditionalFormat`
- Update documentation of the set style functions

Co-authored-by: guoweikuang <weikuang.guo@shopee.com>
2022-12-23 00:54:40 +08:00
xuri ac564afa56
Remove internal error log print, throw XML deserialize error 2022-11-13 00:40:04 +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
davidborry bef49e40ee
This closes #1330 update non existing sheet error messages (#1331) 2022-08-28 00:16:41 +08:00
xuri 1c167b96a3
Improves the calculation engine, docs update, and adds the dependabot
- Initialize array formula support for the formula calculation engine
- Update example and unit test of `AddPivotTable`
- Update the supported hash algorithm of ProtectSheet
2022-05-26 00:15:28 +08:00
xuri 8a335225c7
Format code, update documentation and remove exported variable `XMLHeaderByte` 2022-03-24 00:19:30 +08:00
Jonham.Chen af5c4d00e8
feat: implement SHA-512 algorithm to ProtectSheet (#1115) 2022-01-08 10:32:13 +08:00
xuri 44a13aa402
Export 7 errors so users can act differently on different type of errors 2021-12-07 00:26:53 +08:00
xuri cf9fbafdd8
This closes #979, fix the data validation deletion issue and tidy the internal function in the source code 2021-08-06 22:44:43 +08:00
Deepak S ee8098037d
Prevent panic when incorrect range is provided as PivotTableRange to (#874) 2021-07-10 12:17:41 +08:00
xuri 544ef18a8c
- Support concurrency iterate rows and columns
- Rename exported field `File.XLSX` to `File.Pkg`
- Exported error message
2021-07-05 00:03:56 +08:00
xuri f27624acdd
This closes #866, support use the defined name to reference the data range in pivot table options
- Fix incorrect scope when getting defined name
- Update docs: use column number instead of index on get column width
2021-06-29 22:26:55 +08:00
jinhyuk-kim-ca b83a36a8ae
support ShowError option in Pivot table (#802) 2021-03-13 13:22:28 +08:00
Ludovic Braconnier 2bd359bd01 fix pivot fails in case of multi columns and multi data 2020-09-30 18:20:11 +02:00
jinhyuk-kim-ca c492220237
Pivot table generation fails when no Columns and multiple Data are provided. (#708)
fix to create pivot table in case there is no input from Columns

Co-authored-by: Jin Kim <jinhyuk.kim@cerence.com>
Co-authored-by: xuri <xuri.me@gmail.com>
2020-09-27 13:34:39 +08:00
xuri 96917e4617
Update docs and test case for the pivot table 2020-09-15 23:31:24 +08:00
xuri 10115b5d88 - Resolve #611, fix failure BenchmarkSetCellValue
- Allow empty filter, data, and rows in the pivot table
- Add more test case for pivot table
2020-04-10 00:08:17 +08:00
xuri e36650f4ff
Resolve #598, filter support for AddPivotTable 2020-04-09 01:00:14 +08:00
xuri 821a5d8672
AddPivotTable API changed: new structure PivotTableField to hold pivot table fields for better scalability 2020-02-26 18:53:50 +08:00
xuri 6dcb7013ee
Resolve #582, support to set date field subtotal and names for pivot table
- typo fixed and update do.dev badge in the README.
2020-02-21 23:07:43 +08:00
xuri 1666d04559
optimization: checking error in unit tests 2019-12-24 01:09:28 +08:00
xuri 87390cdd99
Resolve #511, allow empty columns in the pivot table 2019-10-24 23:18:02 +08:00
xuri 3c636da460
Resolve #40, init pivot table support 2019-09-20 00:20:30 +08:00