Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qax-os/excelize
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.6.1
Choose a base ref
...
head repository: qax-os/excelize
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.7.0
Choose a head ref

Commits on Aug 23, 2022

  1. This closes #1290 and closes #1328

    - Add new smooth field in chart format parameter, support specify if smooth line chart
    - Fix decimal number format round issue with build-in number format
    xuri committed Aug 23, 2022
    Copy the full SHA
    cb8bca0 View commit details

Commits on Aug 25, 2022

  1. This closes #1247, add new function SetSheetCol for set worksheet c…

    …olumn values (#1320)
    
    Signed-off-by: cdenicola <cooper.denicola@instabase.com>
    Co-authored-by: cdenicola <cooper.denicola@instabase.com>
    cdenicola and cdenicola authored Aug 25, 2022
    Copy the full SHA
    0e9378f View commit details

Commits on Aug 26, 2022

  1. This closes #827, add new functions GetDataValidations and `GetCond…

    …itionalFormats` (#1315)
    
    Signed-off-by: chenliu1993 <13630583107@163.com>
    chenliu1993 authored Aug 26, 2022
    Copy the full SHA
    f866738 View commit details

Commits on Aug 27, 2022

  1. Copy the full SHA
    bef49e4 View commit details

Commits on Aug 30, 2022

  1. This is a breaking change closes #1332 (#1333)

    This use `InsertRows` instead of `InsertRow`, and using `InsertCols` instead of `InsertCol`
    patsak authored Aug 30, 2022
    Copy the full SHA
    18cd63a View commit details

Commits on Aug 31, 2022

  1. Copy the full SHA
    75ce231 View commit details

Commits on Sep 3, 2022

  1. Copy the full SHA
    00470c1 View commit details

Commits on Sep 6, 2022

  1. Copy the full SHA
    961a3e8 View commit details
  2. This closes #1293, add new function GetColStyle

    - Fix generate workbook corruption after insert cols/rows in some case
    - Update unit tests
    - Update dependencies module
    xuri committed Sep 6, 2022
    Copy the full SHA
    0c5cdfe View commit details

Commits on Sep 8, 2022

  1. This closes #744, the Save, Write and WriteTo function accept s…

    …aving options
    xuri committed Sep 8, 2022
    Copy the full SHA
    fb1aab7 View commit details

Commits on Sep 10, 2022

  1. Copy the full SHA
    c72fb74 View commit details
  2. This makes 6 functions concurrency safety

    - These 6 functions now support concurrency safe: SetColWidth, GetColWidth, SetColVisible, GetColVisible, SetColStyle and GetColStyle
    xuri committed Sep 10, 2022
    Copy the full SHA
    b6cc43d View commit details

Commits on Sep 13, 2022

  1. Copy the full SHA
    73cc4bd View commit details

Commits on Sep 17, 2022

  1. Using the specialized name in a variable and making comments clear

    - Add JSON tags for `AppProperties`, `PivotTableOption` and `PivotTableField` structure
    xuri committed Sep 17, 2022
    Copy the full SHA
    3f70299 View commit details

Commits on Sep 20, 2022

  1. This closes #1354, stream writer will apply style in RowOpts for ea…

    …ch cell (#1355)
    
    Co-authored-by: Tianzhi Jin <tianzhi.jin@iglooinsure.com>
    invzhi and Tianzhi Jin authored Sep 20, 2022
    Copy the full SHA
    74dad51 View commit details

Commits on Sep 22, 2022

  1. Fix cpu usage problem of stream writer when merging cells (#1359)

    Co-authored-by: zzt <zhangzitao@meican.com>
    zhangzitao and mc-zzt authored Sep 22, 2022
    Copy the full SHA
    addcc1a View commit details

Commits on Sep 27, 2022

  1. 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
    xuri committed Sep 27, 2022
    Copy the full SHA
    efcf599 View commit details

Commits on Sep 29, 2022

  1. 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
    xuri committed Sep 29, 2022
    Copy the full SHA
    53a4955 View commit details

Commits on Oct 7, 2022

  1. This closes #1365, normalize the sheet name (#1366)

    Signed-off-by: Joseph Watson <jtwatson@linux-consulting.us>
    jtwatson authored Oct 7, 2022
    Copy the full SHA
    5705132 View commit details

Commits on Oct 8, 2022

  1. Support to set summary columns to appear to the right of detail in an…

    … outline
    
    - Simplify calculation engine code
    - Update documentation for the functions
    - Update dependencies module
    xuri committed Oct 8, 2022
    Copy the full SHA
    b1e776e View commit details

Commits on Oct 9, 2022

  1. Stream writer support to set inline rich text cell (#1121)

    Co-authored-by: zhengchao.deng <zhengchao.deng@meican.com>
    carbin-gun and dengzhengchaomeican authored Oct 9, 2022
    Copy the full SHA
    2f5704b View commit details

Commits on Oct 10, 2022

  1. This closes #1047, stream writer support set panes (#1123)

    - New exported error `ErrStreamSetPanes` has been added
    harrison3000 authored Oct 10, 2022
    Copy the full SHA
    c02346b View commit details

Commits on Oct 11, 2022

  1. This closes #1368, fixes number parsing issue, adds support for creat…

    …e a 3D line chart
    xuri committed Oct 11, 2022
    Copy the full SHA
    0e657c8 View commit details

Commits on Oct 12, 2022

  1. 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
    xuri committed Oct 12, 2022
    Copy the full SHA
    7363c1e View commit details

Commits on Oct 13, 2022

  1. Copy the full SHA
    3d02726 View commit details

Commits on Oct 14, 2022

  1. Copy the full SHA
    3ece904 View commit details

Commits on Oct 19, 2022

  1. This close #1373, fixes the incorrect build-in number format apply th…

    …e result
    
    - An error will be returned when setting the stream row without ascending row numbers, to avoid potential mistakes as mentioned in #1139
    - Updated unit tests
    xuri committed Oct 19, 2022
    Copy the full SHA
    2df615f View commit details

Commits on Oct 20, 2022

  1. Fix the formula calculation result issue of the OR function (#1374)

    Co-authored-by: gonghaibin <gonghaibin@qq.com>
    gonghaibinx and gonghaibin authored Oct 20, 2022
    Copy the full SHA
    f843a9e View commit details

Commits on Oct 23, 2022

  1. Support get cell value which contains a date in the ISO 8601 format

    - Support set and get font color with indexed color
    - New export variable `IndexedColorMapping`
    - Fix getting incorrect page margin settings when the margin is 0
    - Update unit tests and comments typo fixes
    - ref #65, new formula functions: AGGREGATE and SUBTOTAL
    xuri committed Oct 23, 2022
    Copy the full SHA
    14c6a19 View commit details

Commits on Oct 25, 2022

  1. This closes #1377, stream writer writes inline string type for string…

    … cell value
    
    - Add `CellTypeFormula`, `CellTypeInlineString`, `CellTypeSharedString` and remove `CellTypeString` in `CellType` enumeration
    - Unit tests updated
    xuri authored Oct 25, 2022
    Copy the full SHA
    f44153e View commit details
  2. This closes #1379, cleanup stream writer temporary files by the `Clos…

    …e` function
    
    - Fix error on inserting columns or rows on the worksheet which contains one cell merged cell range
    - Fix getting incomplete rich text cell value in some cases
    - Unit tests updated
    xuri committed Oct 25, 2022
    Copy the full SHA
    adf9d37 View commit details

Commits on Oct 27, 2022

  1. Fix the error on getting the range of merged cells on the worksheet w…

    …hich contains one cell merged cell range
    
    - Parse workbook default theme for custom theme color support in the feature
    - Variables name typo fix
    - Add system foreground and background color as RGB in the IndexedColorMapping list
    xuri committed Oct 27, 2022
    Copy the full SHA
    a410b22 View commit details

Commits on Nov 2, 2022

  1. This closes #1204, breaking changes for add comments

    - Allowing insert SVG format images
    - Unit tests updated
    xuri committed Nov 2, 2022
    Copy the full SHA
    db2d084 View commit details
  2. Copy the full SHA
    4998b7b View commit details

Commits on Nov 5, 2022

  1. This closes #1384, fix segmentation fault in formattedValue (#1385)

    - Add nil pointer guard in cell format
    - Add tests to verify the nil checks in formattedValue
    
    Co-authored-by: Zach Clark <zachmclark@gmail.com>
    martinmr and zclark authored Nov 5, 2022
    Copy the full SHA
    75c912c View commit details

Commits on Nov 7, 2022

  1. Copy the full SHA
    8753950 View commit details

Commits on Nov 10, 2022

  1. Support update column style when inserting or deleting columns

    - Go Modules dependencies upgrade
    - Unify internal variable name
    - Unit test updated
    xuri committed Nov 10, 2022
    Copy the full SHA
    58b5dae View commit details

Commits on Nov 11, 2022

  1. This is a breaking change, remove partial internal error log print, t…

    …hrow XML deserialize error
    
    - Add error return value for the `GetComments`, `GetDefaultFont` and `SetDefaultFont` functions
    - Update unit tests
    xuri committed Nov 11, 2022
    Copy the full SHA
    bd5dd17 View commit details

Commits on Nov 12, 2022

  1. Copy the full SHA
    ac564af View commit details

Commits on Nov 15, 2022

  1. This closes #1391, escape XML characters to avoid with corrupt file

    - Update and improve unit test coverage
    xuri committed Nov 15, 2022
    Copy the full SHA
    45d168c View commit details
  2. Copy the full SHA
    aa80fa4 View commit details

Commits on Nov 21, 2022

  1. This closes #1396, fix formula fn ADDRESS result error with empty wor…

    …ksheet name (#1397)
    
    - Update unit tests
    
    Co-authored-by: jayhoo <hujie@ynningneng.com>
    2 people authored and xuri committed Nov 21, 2022
    Copy the full SHA
    dde6b9c View commit details

Commits on Nov 28, 2022

  1. 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
    xuri committed Nov 28, 2022
    Copy the full SHA
    c071395 View commit details

Commits on Dec 1, 2022

  1. This closes #1405, add new function SetSheetBackgroundFromBytes (#1406)

    Co-authored-by: houjianxin.rupert <houjianxin.rupert@bytedance.com>
    jianxinhou and houjianxin.rupert authored Dec 1, 2022
    Copy the full SHA
    5e0953d View commit details

Commits on Dec 6, 2022

  1. Copy the full SHA
    61fda0b View commit details

Commits on Dec 19, 2022

  1. This closes #1416, support set row outline level to stream (#1422)

    Co-authored-by: TlyupovBM <bajjzet.tlyupov@vseinstrumenti.ru>
    Bayzet and TlyupovBM authored Dec 19, 2022
    Copy the full SHA
    ce4f7a2 View commit details

Commits on Dec 22, 2022

  1. 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>
    guoweikuang and guoweikuang authored Dec 22, 2022
    Copy the full SHA
    6a5ee81 View commit details

Commits on Dec 26, 2022

  1. Copy the full SHA
    0c76766 View commit details

Commits on Dec 28, 2022

  1. Copy the full SHA
    a57203a View commit details

Commits on Dec 29, 2022

  1. Breaking change: changed the function signature for 11 exported funct…

    …ions
    
    * 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
    xuri committed Dec 29, 2022
    Copy the full SHA
    f58dabd View commit details
Showing with 8,767 additions and 6,987 deletions.
  1. +1 −1 .github/workflows/go.yml
  2. +9 −9 .gitignore
  3. +1 −1 LICENSE
  4. +59 −44 README.md
  5. +58 −43 README_zh.md
  6. +91 −24 adjust.go
  7. +110 −24 adjust_test.go
  8. +529 −475 calc.go
  9. +199 −69 calc_test.go
  10. +17 −14 calcchain.go
  11. +30 −3 calcchain_test.go
  12. +442 −262 cell.go
  13. +291 −111 cell_test.go
  14. +326 −259 chart.go
  15. +228 −118 chart_test.go
  16. +130 −75 col.go
  17. +113 −43 col_test.go
  18. +136 −117 comment.go
  19. +66 −22 comment_test.go
  20. +24 −23 crypt.go
  21. +6 −4 crypt_test.go
  22. +16 −4 datavalidation.go
  23. +50 −10 datavalidation_test.go
  24. +2 −2 date.go
  25. +24 −19 docProps.go
  26. +8 −8 docProps_test.go
  27. +243 −190 drawing.go
  28. +10 −5 drawing_test.go
  29. +38 −11 errors.go
  30. +59 −40 excelize.go
  31. +624 −432 excelize_test.go
  32. +37 −33 file.go
  33. +17 −0 file_test.go
  34. +8 −9 go.mod
  35. +32 −14 go.sum
  36. +49 −89 lib.go
  37. +11 −10 lib_test.go
  38. +32 −22 merge.go
  39. +28 −14 merge_test.go
  40. +12 −10 numfmt.go
  41. +153 −153 numfmt_test.go
  42. +185 −99 picture.go
  43. +123 −72 picture_test.go
  44. +93 −87 pivotTable.go
  45. +51 −35 pivotTable_test.go
  46. +74 −109 rows.go
  47. +176 −59 rows_test.go
  48. +86 −95 shape.go
  49. +76 −69 shape_test.go
  50. +509 −489 sheet.go
  51. +301 −191 sheet_test.go
  52. +164 −598 sheetpr.go
  53. +80 −479 sheetpr_test.go
  54. +88 −199 sheetview.go
  55. +37 −205 sheetview_test.go
  56. +45 −43 sparkline.go
  57. +58 −42 sparkline_test.go
  58. +264 −129 stream.go
  59. +190 −37 stream_test.go
  60. +730 −226 styles.go
  61. +155 −68 styles_test.go
  62. +73 −97 table.go
  63. +63 −75 table_test.go
  64. +4 −2 templates.go
  65. +2 −2 vmlDrawing.go
  66. +114 −106 workbook.go
  67. +22 −58 workbook_test.go
  68. +2 −2 xmlApp.go
  69. +2 −2 xmlCalcChain.go
  70. +110 −167 xmlChart.go
  71. +2 −2 xmlChartSheet.go
  72. +7 −12 xmlComments.go
  73. +2 −2 xmlContentTypes.go
  74. +2 −2 xmlCore.go
  75. +2 −2 xmlDecodeDrawing.go
  76. +179 −102 xmlDrawing.go
  77. +2 −2 xmlPivotCache.go
  78. +2 −2 xmlPivotTable.go
  79. +5 −4 xmlSharedStrings.go
  80. +41 −38 xmlStyles.go
  81. +23 −20 xmlTable.go
  82. +79 −67 xmlTheme.go
  83. +18 −3 xmlWorkbook.go
  84. +207 −71 xmlWorksheet.go
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x]
go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x]
os: [ubuntu-latest, macos-latest, windows-latest]
targetplatform: [x86, x64]

18 changes: 9 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.DS_Store
.idea
*.json
*.out
*.test
~$*.xlsx
test/*.png
test/BadWorkbook.SaveAsEmptyStruct.xlsx
test/Encryption*.xlsx
test/excelize-*
test/Test*.xlam
test/Test*.xlsm
test/Test*.xlsx
test/Test*.xltm
test/Test*.xltx
# generated files
test/Encryption*.xlsx
test/BadWorkbook.SaveAsEmptyStruct.xlsx
test/*.png
test/excelize-*
*.out
*.test
.idea
.DS_Store
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2016-2022 The excelize Authors.
Copyright (c) 2016-2023 The excelize Authors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
103 changes: 59 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@

## Introduction

Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel&trade; 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Go version 1.15 or later. The full API docs can be seen using go's built-in documentation tool, or online at [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) and [docs reference](https://xuri.me/excelize/).
Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel&trade; 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Go version 1.16 or later. The full docs can be seen using go's built-in documentation tool, or online at [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) and [docs reference](https://xuri.me/excelize/).

## Basic Usage

@@ -44,8 +44,17 @@ import (

func main() {
f := excelize.NewFile()
defer func() {
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
// Create a new sheet.
index := f.NewSheet("Sheet2")
index, err := f.NewSheet("Sheet2")
if err != nil {
fmt.Println(err)
return
}
// Set value of a cell.
f.SetCellValue("Sheet2", "A2", "Hello world.")
f.SetCellValue("Sheet1", "B2", 100)
@@ -83,7 +92,7 @@ func main() {
fmt.Println(err)
}
}()
// Get value from cell by given worksheet name and axis.
// Get value from cell by given worksheet name and cell reference.
cell, err := f.GetCellValue("Sheet1", "B2")
if err != nil {
fmt.Println(err)
@@ -121,41 +130,45 @@ import (
)

func main() {
categories := map[string]string{
"A2": "Small", "A3": "Normal", "A4": "Large",
"B1": "Apple", "C1": "Orange", "D1": "Pear"}
values := map[string]int{
"B2": 2, "C2": 3, "D2": 3, "B3": 5, "C3": 2, "D3": 4, "B4": 6, "C4": 7, "D4": 8}
f := excelize.NewFile()
for k, v := range categories {
f.SetCellValue("Sheet1", k, v)
}
for k, v := range values {
f.SetCellValue("Sheet1", k, v)
defer func() {
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
for idx, row := range [][]interface{}{
{nil, "Apple", "Orange", "Pear"}, {"Small", 2, 3, 3},
{"Normal", 5, 2, 4}, {"Large", 6, 7, 8},
} {
cell, err := excelize.CoordinatesToCellName(1, idx+1)
if err != nil {
fmt.Println(err)
return
}
f.SetSheetRow("Sheet1", cell, &row)
}
if err := f.AddChart("Sheet1", "E1", `{
"type": "col3DClustered",
"series": [
{
"name": "Sheet1!$A$2",
"categories": "Sheet1!$B$1:$D$1",
"values": "Sheet1!$B$2:$D$2"
if err := f.AddChart("Sheet1", "E1", &excelize.Chart{
Type: "col3DClustered",
Series: []excelize.ChartSeries{
{
Name: "Sheet1!$A$2",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$2:$D$2",
},
{
Name: "Sheet1!$A$3",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$3:$D$3",
},
{
Name: "Sheet1!$A$4",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$4:$D$4",
}},
Title: excelize.ChartTitle{
Name: "Fruit 3D Clustered Column Chart",
},
{
"name": "Sheet1!$A$3",
"categories": "Sheet1!$B$1:$D$1",
"values": "Sheet1!$B$3:$D$3"
},
{
"name": "Sheet1!$A$4",
"categories": "Sheet1!$B$1:$D$1",
"values": "Sheet1!$B$4:$D$4"
}],
"title":
{
"name": "Fruit 3D Clustered Column Chart"
}
}`); err != nil {
}); err != nil {
fmt.Println(err)
return
}
@@ -193,22 +206,24 @@ func main() {
}
}()
// Insert a picture.
if err := f.AddPicture("Sheet1", "A2", "image.png", ""); err != nil {
if err := f.AddPicture("Sheet1", "A2", "image.png", nil); err != nil {
fmt.Println(err)
}
// Insert a picture to worksheet with scaling.
if err := f.AddPicture("Sheet1", "D2", "image.jpg",
`{"x_scale": 0.5, "y_scale": 0.5}`); err != nil {
&excelize.GraphicOptions{ScaleX: 0.5, ScaleY: 0.5}); err != nil {
fmt.Println(err)
}
// Insert a picture offset in the cell with printing support.
if err := f.AddPicture("Sheet1", "H2", "image.gif", `{
"x_offset": 15,
"y_offset": 10,
"print_obj": true,
"lock_aspect_ratio": false,
"locked": false
}`); err != nil {
enable, disable := true, false
if err := f.AddPicture("Sheet1", "H2", "image.gif",
&excelize.GraphicOptions{
PrintObject: &enable,
LockAspectRatio: false,
OffsetX: 15,
OffsetY: 10,
Locked: &disable,
}); err != nil {
fmt.Println(err)
}
// Save the spreadsheet with the origin path.
101 changes: 58 additions & 43 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@

## 简介

Excelize 是 Go 语言编写的用于操作 Office Excel 文档基础库,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel&trade; 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档,并提供流式读写 API,用于处理包含大规模数据的工作簿。可应用于各类报表平台、云计算、边缘计算等系统。使用本类库要求使用的 Go 语言为 1.15 或更高版本,完整的 API 使用文档请访问 [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) 或查看 [参考文档](https://xuri.me/excelize/)
Excelize 是 Go 语言编写的用于操作 Office Excel 文档基础库,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel&trade; 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档,并提供流式读写函数,用于处理包含大规模数据的工作簿。可应用于各类报表平台、云计算、边缘计算等系统。使用本类库要求使用的 Go 语言为 1.16 或更高版本,完整的使用文档请访问 [go.dev](https://pkg.go.dev/github.com/xuri/excelize/v2) 或查看 [参考文档](https://xuri.me/excelize/)

## 快速上手

@@ -44,8 +44,17 @@ import (

func main() {
f := excelize.NewFile()
defer func() {
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
// 创建一个工作表
index := f.NewSheet("Sheet2")
index, err := f.NewSheet("Sheet2")
if err != nil {
fmt.Println(err)
return
}
// 设置单元格的值
f.SetCellValue("Sheet2", "A2", "Hello world.")
f.SetCellValue("Sheet1", "B2", 100)
@@ -121,41 +130,45 @@ import (
)

func main() {
categories := map[string]string{
"A2": "Small", "A3": "Normal", "A4": "Large",
"B1": "Apple", "C1": "Orange", "D1": "Pear"}
values := map[string]int{
"B2": 2, "C2": 3, "D2": 3, "B3": 5, "C3": 2, "D3": 4, "B4": 6, "C4": 7, "D4": 8}
f := excelize.NewFile()
for k, v := range categories {
f.SetCellValue("Sheet1", k, v)
}
for k, v := range values {
f.SetCellValue("Sheet1", k, v)
defer func() {
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
for idx, row := range [][]interface{}{
{nil, "Apple", "Orange", "Pear"}, {"Small", 2, 3, 3},
{"Normal", 5, 2, 4}, {"Large", 6, 7, 8},
} {
cell, err := excelize.CoordinatesToCellName(1, idx+1)
if err != nil {
fmt.Println(err)
return
}
f.SetSheetRow("Sheet1", cell, &row)
}
if err := f.AddChart("Sheet1", "E1", `{
"type": "col3DClustered",
"series": [
{
"name": "Sheet1!$A$2",
"categories": "Sheet1!$B$1:$D$1",
"values": "Sheet1!$B$2:$D$2"
if err := f.AddChart("Sheet1", "E1", &excelize.Chart{
Type: "col3DClustered",
Series: []excelize.ChartSeries{
{
Name: "Sheet1!$A$2",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$2:$D$2",
},
{
Name: "Sheet1!$A$3",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$3:$D$3",
},
{
Name: "Sheet1!$A$4",
Categories: "Sheet1!$B$1:$D$1",
Values: "Sheet1!$B$4:$D$4",
}},
Title: excelize.ChartTitle{
Name: "Fruit 3D Clustered Column Chart",
},
{
"name": "Sheet1!$A$3",
"categories": "Sheet1!$B$1:$D$1",
"values": "Sheet1!$B$3:$D$3"
},
{
"name": "Sheet1!$A$4",
"categories": "Sheet1!$B$1:$D$1",
"values": "Sheet1!$B$4:$D$4"
}],
"title":
{
"name": "Fruit 3D Clustered Column Chart"
}
}`); err != nil {
}); err != nil {
fmt.Println(err)
return
}
@@ -193,22 +206,24 @@ func main() {
}
}()
// 插入图片
if err := f.AddPicture("Sheet1", "A2", "image.png", ""); err != nil {
if err := f.AddPicture("Sheet1", "A2", "image.png", nil); err != nil {
fmt.Println(err)
}
// 在工作表中插入图片,并设置图片的缩放比例
if err := f.AddPicture("Sheet1", "D2", "image.jpg",
`{"x_scale": 0.5, "y_scale": 0.5}`); err != nil {
&excelize.GraphicOptions{ScaleX: 0.5, ScaleY: 0.5}); err != nil {
fmt.Println(err)
}
// 在工作表中插入图片,并设置图片的打印属性
if err := f.AddPicture("Sheet1", "H2", "image.gif", `{
"x_offset": 15,
"y_offset": 10,
"print_obj": true,
"lock_aspect_ratio": false,
"locked": false
}`); err != nil {
enable, disable := true, false
if err := f.AddPicture("Sheet1", "H2", "image.gif",
&excelize.GraphicOptions{
PrintObject: &enable,
LockAspectRatio: false,
OffsetX: 15,
OffsetY: 10,
Locked: &disable,
}); err != nil {
fmt.Println(err)
}
// 保存工作簿
Loading