Showing with 9,367 additions and 2,636 deletions.
  1. +4 −40 .github/workflows/codeql-analysis.yml
  2. +3 −3 .github/workflows/go.yml
  3. +4 −1 .gitignore
  4. +1 −1 LICENSE
  5. +1 −1 README.md
  6. +1 −1 README_zh.md
  7. +11 −10 adjust.go
  8. +98 −75 adjust_test.go
  9. +4,006 −729 calc.go
  10. +1,224 −161 calc_test.go
  11. +10 −10 calcchain.go
  12. +1 −1 calcchain_test.go
  13. +96 −85 cell.go
  14. +78 −11 cell_test.go
  15. +10 −10 chart.go
  16. +2 −2 chart_test.go
  17. +21 −35 col.go
  18. +18 −11 col_test.go
  19. +10 −10 comment.go
  20. +9 −8 comment_test.go
  21. +79 −30 crypt.go
  22. +25 −9 crypt_test.go
  23. +35 −40 datavalidation.go
  24. +11 −14 datavalidation_test.go
  25. +9 −10 date.go
  26. +17 −18 docProps.go
  27. +15 −15 docProps_test.go
  28. +43 −31 drawing.go
  29. +13 −8 drawing_test.go
  30. +50 −24 errors.go
  31. +43 −40 excelize.go
  32. +77 −20 excelize_test.go
  33. +27 −11 file.go
  34. +8 −7 go.mod
  35. +19 −16 go.sum
  36. +81 −42 lib.go
  37. +3 −4 lib_test.go
  38. +22 −19 merge.go
  39. +1 −1 merge_test.go
  40. +953 −0 numfmt.go
  41. +1,011 −0 numfmt_test.go
  42. +13 −14 picture.go
  43. +5 −6 picture_test.go
  44. +20 −20 pivotTable.go
  45. +4 −4 pivotTable_test.go
  46. +127 −128 rows.go
  47. +36 −23 rows_test.go
  48. +9 −10 shape.go
  49. +90 −115 sheet.go
  50. +19 −4 sheet_test.go
  51. +8 −8 sheetpr.go
  52. +2 −5 sheetpr_test.go
  53. +88 −66 sheetview.go
  54. +55 −24 sheetview_test.go
  55. +8 −8 sparkline.go
  56. +22 −22 stream.go
  57. +2 −2 stream_test.go
  58. +98 −208 styles.go
  59. +2 −22 styles_test.go
  60. +33 −33 table.go
  61. +12 −19 templates.go
  62. +7 −7 vmlDrawing.go
  63. +176 −0 workbook.go
  64. +57 −0 workbook_test.go
  65. +7 −7 xmlApp.go
  66. +9 −9 xmlCalcChain.go
  67. +25 −25 xmlChart.go
  68. +7 −7 xmlChartSheet.go
  69. +7 −7 xmlComments.go
  70. +8 −8 xmlContentTypes.go
  71. +7 −7 xmlCore.go
  72. +17 −18 xmlDecodeDrawing.go
  73. +22 −19 xmlDrawing.go
  74. +22 −37 xmlPivotCache.go
  75. +10 −13 xmlPivotTable.go
  76. +7 −7 xmlSharedStrings.go
  77. +39 −39 xmlStyles.go
  78. +8 −8 xmlTable.go
  79. +7 −7 xmlTheme.go
  80. +53 −51 xmlWorkbook.go
  81. +69 −55 xmlWorksheet.go
44 changes: 4 additions & 40 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 6 * * 3'
Expand All @@ -22,50 +16,20 @@ jobs:
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['go']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.15.x, 1.16.x, 1.17.x]
go-version: [1.15.x, 1.16.x, 1.17.x, 1.18.x]
os: [ubuntu-latest, macos-latest, windows-latest]
targetplatform: [x86, x64]

Expand All @@ -14,12 +14,12 @@ jobs:
steps:

- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get dependencies
run: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
~$*.xlsx
test/Test*.xlsx
test/Test*.xlam
test/Test*.xlsm
test/Test*.xlsx
test/Test*.xltm
test/Test*.xltx
# generated files
test/BadEncrypt.xlsx
test/BadWorkbook.SaveAsEmptyStruct.xlsx
Expand Down
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-2021 The excelize Authors.
Copyright (c) 2016-2022 The excelize Authors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 XLSX / XLSM / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 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™ 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/).

## Basic Usage

Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## 简介

Excelize 是 Go 语言编写的用于操作 Office Excel 文档基础库,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / 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™ 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/)

## 快速上手

Expand Down
21 changes: 11 additions & 10 deletions adjust.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright 2016 - 2021 The excelize Authors. All rights reserved. Use of
// Copyright 2016 - 2022 The excelize Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
//
// Package excelize providing a set of functions that allow you to write to
// and read from XLSX / XLSM / XLTM files. Supports reading and writing
// spreadsheet documents generated by Microsoft Excel™ 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.
// Package excelize 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™ 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.

package excelize

Expand Down Expand Up @@ -81,13 +81,13 @@ func (f *File) adjustRowDimensions(ws *xlsxWorksheet, row, offset int) {
for i := range ws.SheetData.Row {
r := &ws.SheetData.Row[i]
if newRow := r.R + offset; r.R >= row && newRow > 0 {
f.ajustSingleRowDimensions(r, newRow)
f.adjustSingleRowDimensions(r, newRow)
}
}
}

// ajustSingleRowDimensions provides a function to ajust single row dimensions.
func (f *File) ajustSingleRowDimensions(r *xlsxRow, num int) {
// adjustSingleRowDimensions provides a function to adjust single row dimensions.
func (f *File) adjustSingleRowDimensions(r *xlsxRow, num int) {
r.R = num
for i, col := range r.C {
colName, _, _ := SplitCellName(col.R)
Expand Down Expand Up @@ -226,6 +226,7 @@ func (f *File) adjustMergeCells(ws *xlsxWorksheet, dir adjustDirection, num, off
i--
continue
}
areaData.rect = []int{x1, y1, x2, y2}
if areaData.Ref, err = f.coordinatesToAreaRef([]int{x1, y1, x2, y2}); err != nil {
return err
}
Expand Down
Loading