Commit Graph

127 Commits

Author SHA1 Message Date
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 2cfcf9eb5f encode the escaped string literal which not permitted in an XML 1.0 document 2021-06-16 15:03:50 +00:00
xuri e354db69b0
string pattern match context check instead of regex lookahead assertion 2021-06-13 11:23:52 +08:00
xuri 5faa36430c
skip XML control character in the escape literal string, and update dependencies 2021-06-12 08:49:18 +08:00
xuri 83e12cc4e5
support escaped string literal basic string and use GitHub Action instead of TravisCI
- Note that: travis-ci.org will shutdown on June 15th, 2021, and I don't have enough permission to migrate this project to travis-ci.com currently
2021-06-11 22:48:37 +08:00
xuri be12cc27f1
This closes #652, new SetColWidth API, support set column width in stream writing mode, and export error message 2021-05-10 00:09:24 +08:00
xuri 7e429c5b46
Fixe issue generated file corrupted caused by incorrect default XML namespace attributes 2021-04-30 00:14:42 +08:00
xuri 737b7839a2
Fixed #819, read empty after streaming data writing
#65 fn: IMAGINARY, IMARGUMENT, IMCONJUGATE and IMDIV
2021-04-08 00:50:59 +08:00
xuri f8f699a172
Go 1.15 and later required, #65 fn: IMABS, IMCOS, IMCOSH, IMCOT, IMCSC, IMCSCH, IMEXP, IMLN and IMLOG10 2021-04-04 15:29:43 +08:00
xuri 2af96c0714
#65 fn: N, PERCENTILE.INC and T
typo fixed
2021-03-30 23:02:22 +08:00
xuri afe2ebc261 This improves compatibility for absolute XML path, Windows-style directory separator and inline namespace; 2021-02-27 08:49:10 +08:00
xuri 36b7990d6b
lint issue fixed and new formula function: ATAN, AVERAGE, AVERAGEA, CONCAT, CONCATENATE, COUNT, COUNTBLANK, MAX 2021-02-15 00:09:35 +08:00
xuri 1f329e8f96
This closes #774, closes #775 and closes #776
- correct adjust calculation chain in duplicate rows
- correct adjust defined name in the workbook when delete worksheet
- use absolute reference in the auto filters defined name to make it compatible with OpenOffice
- API `CoordinatesToCellName` have a new optional param to specify if using an absolute reference format
- Fix cyclomatic complexity issue of internal function `newFills` and `parseToken`
2021-02-02 22:23:16 +08:00
xuri b84bd1abc0
new formula fn: IF, LEN; not equal operator support and faster numeric precision process 2021-01-27 13:51:47 +08:00
xuri c82a185af8
Compatibility improvement: parse document core part (workbook) dynamically 2020-11-04 00:28:20 +08:00
Ted fcca8a3838
optimize memory allocation (#722)
* optimize marshal

* optimize mem alloc

* add benchmark testing

* add NewSheetWithRowNum testing

* sync struct fields order

* add BenchmarkNewSheetWithStreamWriter

* delete NewSheetWithRowNum and benchmark test
2020-11-03 17:48:37 +08:00
xuri c3e92a51d7 Compatible with Go 1.15, fix unit test failed on Windows and fixed #689 potential race condition 2020-08-15 09:19:35 +00:00
xuri 843bd24e56 This closes #677 and closes #679, fix panic when enabling compiler inline flags 2020-08-06 05:58:40 +00:00
xuri 13e7bce6d2
improvement compatibility for the XML ignorable namespace 2020-07-20 00:05:37 +08:00
xuri ca43c65115
Update test for addTable 2020-07-19 00:10:42 +08:00
xuri c922c32fb7
support parse and generate XML element namespace dynamic, fix #651 2020-07-18 15:15:16 +08:00
xuri 49257c5918
support case-sensitive doc parts to improve compatibility 2020-07-09 01:24:11 +08:00
xuri 15fd56853f
Update docs and typo fixed 2020-06-22 00:14:56 +08:00
xuri 5221729bc3
make columns iterator read cell streamingly and add max column limit on ColumnNumberToName 2020-06-22 00:05:19 +08:00
xuri 2ae631376b
add limits for total columns, row and filename length 2020-05-29 00:26:40 +08:00
xuri 7f78464f7f
add test for ReadZipReader, close #642 2020-05-23 13:29:51 +08:00
sachin-puranik 82bb1153d7
Improved error handling and stoped the crash due to fatel error (#593) close #624 2020-05-23 12:51:46 +08:00
xuri 2efc7107ff
- transform the range to the matrix on the first arg of the formula
- typo fix
- reset cell with and height when insert picture into merged cell with autofit
2020-05-21 22:57:58 +08:00
xuri 48fc4c08a2
init formula calculation engine, ref #65 and #599 2020-05-03 18:44:43 +08:00
xuri 0f2a905324 Performance improvements 2020-04-05 13:51:00 +08:00
xuri 09485b3f9f
Improve code coverage unit tests 2019-12-29 16:02:31 +08:00
xuri 4e4a5b9b3e
Improve compatibility, fix workbook's rels ID calc error 2019-12-23 00:07:40 +08:00
Michael 9fe267ffcf Pre-allocate some memory when reading files (#510) 2019-10-24 22:14:33 +08:00
xuri 9c70d0ac86
Documentation updated, Go 1.10+ required 2019-08-11 00:36:14 +08:00
xuri 0660f30cdd
godoc update and typo fixed 2019-04-20 14:57:50 +08:00
xuri 40ff5dc1a7
refactor: handler error instead of panic,
Exported functions:

SetCellStyle
InsertCol
RemoveCol
RemoveRow
InsertRow
DuplicateRow
DuplicateRowTo
SetRowHeight
GetRowHeight
GetCellValue
GetCellFormula
GetCellHyperLink
SetCellHyperLink
SetCellInt
SetCellBool
SetCellFloat
SetCellStr
SetCellDefault
GetCellStyle
SetCellValue
MergeCell
SetSheetRow
SetRowVisible
GetRowVisible
SetRowOutlineLevel
GetRowOutlineLevel
GetRows
Columns
SearchSheet
AddTable
GetPicture
AutoFilter
GetColVisible
SetColVisible
GetColOutlineLevel
SetColOutlineLevel
SetColWidth
GetColWidth

inner functions:

adjustHelper
adjustMergeCells
adjustAutoFilter
prepareCell
setDefaultTimeStyle
timeToExcelTime
addDrawingChart
addDrawingVML
addDrawingPicture
getTotalRowsCols
checkRow
addDrawingShape
addTable
2019-03-23 20:08:06 +08:00
xuri beff7b4f3c
Typo fixed and godoc updated 2019-03-20 15:13:41 +08:00
Veniamin Albaev dc01264562 Huge refactorig for consistent col/row numbering (#356)
* Huge refactorig for consistent col/row numbering

Started from simply changing ToALphaString()/TitleToNumber() logic and related fixes.
But have to go deeper, do fixes, after do related fixes and again and again.

Major improvements:

1. Tests made stronger again (But still be weak).
2. "Empty" returns for incorrect input replaces with panic.
3. Check for correct col/row/cell naming & addressing by default.
4. Removed huge amount of duplicated code.
5. Removed ToALphaString(), TitleToNumber() and it helpers functions at all,
and replaced with SplitCellName(), JoinCellName(), ColumnNameToNumber(), ColumnNumberToName(), CellNameToCoordinates(), CoordinatesToCellName().
6. Minor fixes for internal variable naming for code readability (ex. col, row for input params, colIdx, rowIdx for slice indexes etc).

* Formatting fixes
2019-03-20 00:14:41 +08:00
Olivier Mengué e780e41e02 Faster TitleToNumber (#343)
* TestTitleToNumber: more test cases

* TitleToNumber: drop use of math.Pow()

Compute using pure integers

* TitleToNumber: simplify

Remove unecessary casts to int
2019-02-02 11:05:01 +08:00
xuri fabd9d013f
README updated 2019-01-01 13:20:14 +08:00
HcySunYang 4dbc78ce0a resolve #273 new feature: protect sheet support
new feature: protect sheet support, relate issue #273
2018-11-02 23:08:31 +08:00
xuri 1c45425f12
resolve #276, add OfficeOpenXML-XMLSchema-Strict mode support 2018-10-17 00:28:31 +08:00
xuri 3e004d900b
Comments style changed. 2018-09-14 00:58:48 +08:00
xuri 13a9769cc5
Comments style changed. 2018-09-14 00:44:23 +08:00
xuri 2f146c923c
Comments style changed. 2018-09-14 00:35:47 +08:00
xuri b4a6e61ec3
Fix golint errors under confidence 0.1 2018-09-12 15:47:56 +08:00
xuri ec37b114c3
Fixes #256 and format document. 2018-08-06 10:21:24 +08:00
xuri 79dfe1c307
GoDoc updated. 2018-07-13 17:40:47 +08:00
Olivier Mengué 4a1b406456 CopySheet() using reflect instead of encoding/gob
Use github.com/mohae/deepcopy to deep copy worksheets instead of the
internal deepcopy function that was using encoding/gob serialization and
deserialization.

Rationale:
1/ using `encoding/gob` is much slower than
   [`mohae/deepcopy`](https://github.com/mohae/deepcopy/)
2/ When building an application this implementation of `deepcopy` drags
   the `encoding/gob` package into the binary. And this package is much
   bigger than `mohae/deepcopy` (which only depends on `time` and `reflect`).

```
$ LC_ALL=C stat -f "%6z %N" $(go env GOPATH)/pkg/$(go env GOOS)_$(go env GOARCH)/github.com/mohae/deepcopy.a $(go env GOROOT)/pkg/$(go env GOOS)_$(go env GOARCH)/encoding/gob.a
 10508 .../pkg/darwin_amd64/github.com/mohae/deepcopy.a
541818 .../pkg/darwin_amd64/encoding/gob.a
```
2018-06-14 17:54:31 +02:00
xuri 9e463b4614
- Add error return value for functions: `AddChart()`, `AddComment()`, `AddPicture()`, `AddShape()`, `AddTable()` and `SetConditionalFormat()`
- go test has been updated
2018-05-27 11:25:55 +08:00
Lunny Xiao 38ad20efc1
save bytes on memory instead of string 2018-05-07 16:12:51 +08:00
mbresson 317ef65381 make SetCellStyle quicker by skipping conversions in checkCellInArea, and skipping area checks when we are sure the cell can't be before or past the current row/col
Signed-off-by: Matthieu Bresson
2018-01-19 17:49:09 +08:00
Olivier Mengué 88e48e079a Add SetSheetViewOptions and GetSheetViewOptions (#145)
Two new methods:
- SetSheetViewOptions(sheetName string, viewIndex int, opts ...SheetViewOption) error
- GetSheetViewOptions(sheetName string, viewIndex int, opts ...SheetViewOptionPtr) error

The option values are given by the user through types that have privates methods
that implement the private SheetViewOption and SheetViewOptionPtr interfaces:
- DefaultGridColor(bool)
- RightToLeft(bool)
- ShowFormulas(bool)
- ShowGridLines(bool)
- ShowRowColHeaders(bool)

Examples:
    err := xl.SetSheetViewOptions("Sheet1", -1, excelize.ShowGridLines(true))

    var showGridLines excelize.ShowGridLines
    err := xl.GetSheetViewOptions("Sheet1", -1, &showGridLines)

Fixes #145.
2017-11-16 12:00:36 +01:00
Ri Xu 1f93fc7bad Optimize code. 2017-09-06 12:16:39 +08:00
lichaofei 787495c503 Update lib.go 2017-09-05 18:26:47 +08:00
lichaofei 1169042f7d Update lib.go 2017-09-05 18:06:38 +08:00
Ri Xu 1ec2661dda
Bugfix: deep copy issue with function `CopySheet()`, relate PR #108. 2017-08-19 13:37:15 +08:00
Ri Xu 555e2ba9a8
- Make function `TitleToNumber()` exportable, note that function `ToAlphaString()` return value calculation changes, get more info from go doc. Relate issue #63;
- Readme and go doc updated
2017-06-27 17:53:06 +08:00
Ri Xu 35841caaf1
- Function `formattedValue()` performance improvement by avoid repeating deserialization, relate issue #64;
- Make function `ToAlphaString()` exportable, relate issue #63
2017-06-26 18:44:19 +08:00
Ri Xu 1f73f08185 - New feature: border setting support (Related issue #21);
- Function parameter code is simplified;
- Fix element `Tint` value parsing error in worksheet;
- Update go test
2017-03-06 12:05:41 +08:00
Josh Fyne d9f4a2f154 Standardize input and output 2017-02-16 13:25:55 -05:00
Ri Xu 0833a9d5da - Improved performance when reading large files, call Token to read tokens one by one instead Unmarshal. Related issue #20 ;
- Fix go test typo;
- Update README
2017-02-12 19:03:24 +08:00
Ri Xu bd5b033b02 Support set work sheet background image. 2017-01-24 18:29:02 +08:00
Ri Xu 9559f454a7 Fix issue #17, update README and fix typo. 2017-01-23 16:15:01 +08:00
Ri Xu 52796f6e58 Format commants, break comments after 80 characters. 2017-01-18 16:05:01 +08:00
Ri Xu f05df2a018 - New function `SetSheetName` and `SetColWidth` added, support rename sheet and set column width;
- Add escape characters of sheet name;
- Update go test and fix typo
2017-01-18 14:47:23 +08:00
Ri Xu 9e8d36ce59 - Performance improvement, remove `replaceRelationshipsID` and `workBookCompatibility` functions;
- New functions `GetActiveSheetIndex`, `GetSheetName` and `GetSheetMap` added.
2016-12-31 23:47:30 +08:00
Ri Xu f958f05a3b - Fix issue: sheet protection and conditional formatting proprietary missing after save;
- Update workbook and sheet relationships and self-close tag replacement hack functions
2016-12-26 23:55:59 +08:00
Ri Xu 75abc628fe Update godoc of package. 2016-10-19 20:39:44 +08:00
Ri Xu 2e8fa2d39c Use conjunction with strings.Map to split Axis and update godoc. 2016-09-12 17:37:06 +08:00
Ri Xu 0dd0fba96b Move execute checkRow logic when XLSX file open, speed up library write file. 2016-09-07 20:09:02 +08:00
Ri Xu df8f85d6ab Open file error return added and UpdateLinkedValue function added to fix linked values within a spreadsheet are not updating. 2016-09-06 21:20:24 +08:00
Ri Xu 50863294f9 Fix issue #2 change project to object-oriented style and update readme file. 2016-09-05 16:37:15 +08:00
Ri Xu 956a4627d1 Fix issue #4 use builtin `map` instead of home-built. 2016-09-05 10:44:32 +08:00
Ri Xu 192af02a40 Format code with golint rules 2016-09-02 11:54:52 +08:00
Ri Xu 0e61ae7eda 1) Update readme file credits and go report badge added; 2) Remove use less function; 3) Update test file. 2016-08-31 19:27:44 +08:00
Ri Xu a9d3ee2869 Init commit. 2016-08-30 11:51:31 +08:00