Commit Graph

189 Commits

Author SHA1 Message Date
xuri 89b85934f6
This closes #1096, memory usage optimization and another 4 changes
- Unzip shared string table to system temporary file when large inner XML, reduce memory usage about 70%
- Remove unnecessary exported variable `XMLHeader`, we can using `encoding/xml` package's `xml.Header` instead of it
- Using constant instead of inline text for default XML path
- Rename exported option field `WorksheetUnzipMemLimit` to `UnzipXMLSizeLimit`
- Unit test and documentation updated
2021-12-27 23:49:28 +08:00
xuri 790c363cce This closes #833, closes #845, and closes #1022, breaking changes
- Close spreadsheet and row's iterator required
- New options `WorksheetUnzipMemLimit` have been added
- Improve streaming reading performance, memory usage decrease about 93.7%
2021-09-19 11:06:54 +08:00
xuri 684603befa
This closes #993, closes #1014
- Fix formula percentages calculated incorrectly
- Make UpdateLinkedValue skip macro sheet
- Fix conditional format bottom N not working
2021-09-06 00:01:42 +08:00
xuri 32b23ef42d
This closes #998
- Support text comparison in the formula, also ref #65
- `GetCellValue`, `GetRows`, `GetCols`, `Rows` and `Cols` support to specify read cell with raw value, ref #621
- Add missing properties for the cell formula
- Update the unit test for the `CalcCellValue`
2021-09-05 11:59:50 +08:00
xuri cd030d4aa8
Improve compatibility with row element with r="0" attribute 2021-08-23 00:15:43 +08:00
xuri a2d449708c
- This fix panic and incorrect cell read on some case
- Make unit test on Go 1.7
- API documentation updated
2021-08-22 13:36:56 +08:00
xuri 48c16de8bf
Improve security and simplify code
- Make variable name more semantic
- Reduce cyclomatic complexities for the formula calculate function
- Support specified unzip size limit on open file options, avoid zip bombs vulnerability attack
- Typo fix for documentation and error message
2021-08-15 00:06:40 +08:00
xuri b7fece5173
Support concurrency add picture 2021-07-06 00:31:04 +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 0e02329bed
This closes #861, support concurrency get cell picture and remove unused internal function `getSheetNameByID` 2021-07-04 12:13:06 +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 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
yuki2006 dbe88d723e
Fix UpdateLinkedValue which returns an error when has graph sheet (#793)
* Fixed UpdateLinkedValue which returns an error when there is a graph sheet

Signed-off-by: yuuki.ono <yagfair@gmail.com>

* fix refactoring from review

Signed-off-by: yuuki.ono <yagfair@gmail.com>
2021-03-04 09:23:45 +08:00
Ray 58ecf81630
Update excelize.go (#765)
miss a char as 'l' in the excel.
2021-01-20 14:40:33 +08:00
xuri 92c8626f81
Fixed #732, support single line with repeated row element in the sheet data 2020-11-18 22:08:40 +08:00
xuri 2514bb16c6 Fix #724, standardize variable naming and update unit tests 2020-11-11 01:03:56 +08:00
xuri 5dd0b4aec2
using POSIX directory separator in zip path with Windows 2020-11-06 20:03:13 +08:00
xuri c82a185af8
Compatibility improvement: parse document core part (workbook) dynamically 2020-11-04 00:28:20 +08:00
Lijingfeng 93160287bb
Optimize memory usage when stream flush and save (#659)
* use io.Copy from stream temp file to zip Writer

* fix nil

* log

* build

* delete log

* fix compatibility for office

* Update go module

Co-authored-by: lijingfeng <lijingfeng@laiye.com>
Co-authored-by: xuri <xuri.me@gmail.com>
2020-10-05 22:17:11 +08:00
Artem Kustikov f2b8798a34
extend cell value load to support custom datetime format (#703)
* extend cell value load to support custom datetime format

* cleanup incorrect imports

* fix numeric values conversion as done in legacy Excel

* fix tests coverage

* revert temporary package name fix

* remove personal info from test XLSX files

* remove unused dependencies

* update format conversion in parseTime

* new UT to increase code coverage

* Resolve code review issue for PR #703

* Rename broken file name generated by unit test

Co-authored-by: xuri <xuri.me@gmail.com>
2020-10-04 21:07:39 +08:00
xuri 89465f41b5
Update dependency package version and docs for the OpenFile 2020-09-22 22:29:43 +08:00
xuri 01afc6e03f init ECMA-376 agile encryption support 2020-09-06 19:32:00 +08:00
xuri 98f1a69903
support ECMA-376 document standard encryption, ref #199 2020-09-02 23:14:19 +08:00
xuri 4177c1585e Resolve #199, init password protection spreadsheet support 2020-09-01 00:47:44 +08:00
xuri 4e4baac3bc using Mutex lock and update benchmark 2020-08-16 03:48:11 +00: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 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 48f19f60aa
support the row element without r attribute in the worksheet 2020-06-27 00:02:47 +08:00
xuri c168233e70
speedup get cell value from shared string table 2020-05-27 00:02:29 +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 1fe660df64
- Resolve #485 use sheet index instead of ID
-  added 3 internal function: getSheetID, getActiveSheetID, getSheetNameByID
2020-04-23 02:01:14 +08:00
xuri 0f2a905324 Performance improvements 2020-04-05 13:51:00 +08:00
xuri 3f89c6e979
remove ineffectual variable assignments and simplify code 2020-03-29 18:44:24 +08:00
xuri 6afc468a02
Resolve #451, support create chart sheet 2020-03-28 23:47:26 +08:00
xuri 9e2318cefa
Resolve #470, export Style structs to allow create the style for cells by given JSON or structure 2020-03-10 00:04:23 +08:00
xuri 2ccb8f62ed
Remove calculated properties to make recalculate formulas in some spreadsheet applications, such as Kingsoft WPS 2020-03-09 00:08:47 +08:00
xuri ad883caa0f
Resolve #580, revert commit 5ca7231ed4 2020-02-19 00:08:10 +08:00
xuri 5f5ec76740
Fix #551, handle empty rows in streaming reading 2019-12-31 01:01:16 +08:00
xuri 09485b3f9f
Improve code coverage unit tests 2019-12-29 16:02:31 +08:00
xuri 1666d04559
optimization: checking error in unit tests 2019-12-24 01:09:28 +08:00
xuri 4e4a5b9b3e
Improve compatibility, fix workbook's rels ID calc error 2019-12-23 00:07:40 +08:00
match-meng 7358dca436 Update comments for the xmlNewDecoder (#542) 2019-12-20 22:22:56 +08:00
xuri 4249dad8ea
Resolve #539 Merge branch 'v2'
# Conflicts:
#	rows.go
#	sheet.go
2019-12-20 01:00:15 +08:00
Alex Geer b1b3c0d151 Fix #539 Fixed error opening excel file created in encoding d… (#540)
* Fixed issue #539 Fixed error opening excel file created in encoding different from UTF-8, added logging of possible errors when decoding XML if the function does not provide exit with an error

* Added test for CharsetReader

* Fixed #discussion_r359397878

Discussion: https://github.com/360EntSecGroup-Skylar/excelize/pull/540#discussion_r359397878

* Fixed go fmt

* go mod tidy and removed unused imports

* The code has been refactored
2019-12-20 00:30:48 +08:00
xuri 402ad2f62b
Update XML namespace 2019-11-30 00:06:36 +08:00
xuri 8d6e431dcd
Resolve #521, fix missing elements when parsing 2019-11-28 21:53:50 +08:00
Harris bf9a835549
Reduce allocations when writing
Fix #494

If a row is full, don't bother allocating a new one, just return it.

Use the last populated row as a hint for the size of new rows.

Simplify checkSheet to remove row map
2019-11-05 08:18:11 -06:00
xuri 8922f65978
Combine functions:
workBookRelsWriter, drawingRelsWriter into relsWriter;
drawingRelsReader, workbookRelsReader, workSheetRelsReader into relsReader;
addDrawingRelationships, addSheetRelationships into addRels
2019-09-16 01:17:35 +08:00
xuri 9c70d0ac86
Documentation updated, Go 1.10+ required 2019-08-11 00:36:14 +08:00
xuri cbe919fdf6
New feature: sparkline supported 2019-08-04 20:24:59 +08:00
xuri 35e485756f
Resolve #217, new function add VBA project supported. 2019-07-21 12:56:36 +08:00
xuri 54def7eaad
Add TIF, TIFF format images and more detailed error information when open the encrypted file 2019-06-27 21:58:14 +08:00
xuri b1f632d408 Resolve #393, upgrade Go module to v2 2019-05-02 15:57:47 +08:00
xuri 0660f30cdd
godoc update and typo fixed 2019-04-20 14:57:50 +08:00
xuri a88459d5f1
add unit tests to functions 2019-04-16 10:57:21 +08:00
xuri f2df344739
Resolve #369,#370
add error return value

exported functions:

GetMergeCells
ProtectSheet
UnprotectSheet
UpdateLinkedValue
GetMergeCells
SetSheetVisible

inner functions:

workSheetReader
copySheet
2019-04-15 11:22:57 +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
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
xuri f66212da9b
Resolve #106, #294 performance optimization for add hyperlink 2019-02-26 14:21:44 +08:00
xuri 1aed1d744b
Resolve #274, performance optimization for add images, charts and shapes 2019-02-25 22:14:34 +08:00
BluesJhao 1427027e38 Resolve #235, performance optimization for add comments (#347) 2019-02-25 00:29:58 +08:00
xuri 0072bb7310
resolve the issue corrupted xlsx after deleting formula of cell, reference #346 2019-02-22 22:17:38 +08:00
Veniamin Albaev 725c1a0c40 New feature: File.DuplicateRowTo() duplicate row to specified row position.
DuplicateRowTo() is similar to DuplicateRow() but copies specified row not just after specified source row
but to any other specified position below or above source row.

Also I made minor modifications of tests: using filepath.Join() instead of direct unix-way paths strings
to avoid possible tests fails on other OS.
2019-01-10 14:29:19 +03:00
zhangleijlu 034de7acd8 Resolve #318, add new functions and 2019-01-06 14:12:31 +08:00
xuri fabd9d013f
README updated 2019-01-01 13:20:14 +08:00
xuri 9a6f66a996
New feature: the function `SearchSheet` now support regular expression, relate pull request #316 2018-12-26 14:48:14 +08:00
Veniamin Albaev 7b7ca99f5d Duplicate row (#317)
* go mod tidy applied

* File.DuplicateRow() method added
2018-12-26 13:33:40 +08:00
xuri 3ca3156d45
Merge pull request #313 from sairoutine/feature/get_merge_cells
Add GetMergeCells
2018-12-19 23:32:12 +08:00
sairoutine 3012df08eb Add GetMergeCells 2018-12-19 20:54:38 +09:00
xuri b89f75c896
Add new logo for excelize 2018-12-05 00:27:19 +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 d6468fc114
- Initialize theme support;
- RGBA, HSL color convert has been added;
- go test updated
2018-07-07 15:59:48 +08: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
xuri e8961f0aff
- Bugfix: set font family not works, relate issue #222;
- Remove useless function `replaceWorkSheetsRelationshipsNameSpace()`;
- Make test cases use strict error checking
2018-05-08 10:36:13 +08:00
Lunny Xiao 38ad20efc1
save bytes on memory instead of string 2018-05-07 16:12:51 +08:00
Ri Xu 52b1a8e896
- Function `SetCellValue()` time.Duration support added, relate issue #176;
- go test updated
2018-01-05 09:39:31 +08:00
Ri Xu 96b3e1ea74
Bugfix: corrupted xlsx after write operation, relate issue #152.
Signed-off-by: Ri Xu <xuri.me@gmail.com>
2017-11-16 10:24:45 +08:00
xuri a4ffb4fbfc
Merge pull request #141 from WingGao/wing
fix OpenReader no sheet error
2017-11-03 10:31:48 +08:00
Ri Xu f10ee929d0
- Bugfix: use sheet name in func `AddPicture`, relate issue #142;
- godoc updated
2017-10-31 16:33:36 +08:00
Wing Gao 48b8bac126 fix OpenReader no sheet error 2017-10-27 22:05:00 +08:00
Ri Xu 8077732dff
Bugfix: read sheet name error, relate issue #137
Signed-off-by: Ri Xu <xuri.me@gmail.com>
2017-10-18 19:07:35 +08:00
Ri Xu 9b5b74d480
Performance optimization, use the array index instead of the value in range. 2017-10-16 10:42:43 +08:00
Ri Xu 905be463ed
Improve code readability. 2017-09-30 17:07:59 +08:00
Ri Xu f05f799f8d
- API changed, use worksheet name instead of "sheet" + index, related issue #25, #43, #47, #51, #89, #101, #116 and #120.
- go test updated
2017-09-13 22:00:33 +08:00
Ri Xu 6aa59a1af2
- Init insert/remove column/row support. Relate issue #77 and #82;
- Readme and go test updated
2017-07-24 10:26:02 +08:00
Ri Xu 38df838598
Bugfix: unable to read the value of the merged cell, relate issue #78 2017-07-05 13:30:56 +08:00
Ri Xu 654a676d93
- New function `NewStyle()` added and function `SetCellStyle()` has been exported, relate issue #72;
- go test and go doc updated
2017-06-29 19:41:00 +08:00
Ri Xu e05867a033
Function `GetCellValue()` performance improvement by avoid repeating deserialization, relate issue #70. 2017-06-29 13:28:44 +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 db4aff04fd
- Handle pre-defined number format set of cell when set cell value with `time.Time` data type, related issue #62;
- go doc updated
2017-06-23 21:07:30 +08:00
Ri Xu efff54ccde - Fixed coordinate parse error in function `SetCellStyle()`, relate issue #60;
- Simplified code
2017-06-12 18:05:09 +08:00