Commit Graph

185 Commits

Author SHA1 Message Date
Dokiy 67127883dd
Fix adjustMergeCells not modifies cell rect (#1118) 2022-01-14 00:28:31 +08:00
xuri 891e5baac1
ref #1096, reduce memory usage by about 50% for large data spreadsheet 2022-01-11 00:31:11 +08:00
xuri 2245fccca0
Typo fix, rename exported constants, dependencies modules and copyright update
Rename exported constants `NameSpaceDublinCoreMetadataIntiative` to `NameSpaceDublinCoreMetadataInitiative`
2022-01-09 00:20:42 +08:00
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 e0c6fa1beb
Update docs for SetSheetStyle, and added 2 formula functions
ref #65: new formula functions DURATION and MDURATION
fix incorrect example in SetSheetStyle docs
2021-12-04 13:11:01 +08:00
li 60b13affbd
Support get current row/col and total rows/cols in the stream reader (#1054) 2021-11-05 00:01:34 +08:00
xuri de38402f74
This closes #1031, fix small float parsed error in some case
- new formula function: YEARFRAC, ref #65
- update the codecov version
- remove unused variable
2021-10-15 21:45:46 +08:00
xuri 490f3063c2
This closes #1026, time parse accuracy issue and typo fixed 2021-09-26 00:07:40 +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 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 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 a55f354eb3
This closes #989, closes #990
New API: `SetRowStyle` support for set style for the rows
Update documentation for the `GetRows`, `SetCellStyle` and `SetColStyle`
2021-08-17 00:01:44 +08:00
three f6f14f507e
Speed up merge cells 2021-08-13 01:32:44 +08:00
xuri f62c45fe0c
This closes #848 and closes #852, fix reading decimals precision 2021-07-12 00:02:39 +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
strong c62ced7ca7
fix getRowHeight actually get the height of the next row (#860) 2021-06-13 14:42:09 +08:00
xuri bffb5d6b41
make the caller of `getRowHeight` function adapt row number change, update comment: use rows number instead of rows index. 2021-06-13 14:38:01 +08:00
xuri d932e62a12
This closes #855, fix missing formula cell when getting rows value 2021-06-05 00:06:14 +08:00
william 2f74ec171d fix the bug when there was no count attribute in sharedStrings file 2021-05-24 15:27:36 +08:00
xuri 5bf3ea6154
This closes #842, avoid empty rows in the tail of the worksheet 2021-05-16 00:03:09 +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
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 30549c5e90
fix custom row height check issue 2021-02-08 18:05:15 +08:00
xuri 2fb135bc94
handle end element event in the worksheet row/column iterator XML SAX parser 2021-02-05 22:52:31 +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 1bc5302007
Fixed #764, add a condition for round precision 2021-01-20 00:14:21 +08:00
xuri 576bfffbe6 This closes #752, fix incorrectly merged cells on duplicate row, and new formula function: LOWER, PROPER, UPPER 2020-12-22 01:48:52 +00:00
xuri 599a8cb0bc
Fixed #727, rounding numeric with precision for formula calculation 2020-11-19 21:38:35 +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
Eugene Androsov 2be4bfd410
Fix row duplicate mechanism (#729) 2020-11-15 10:58:45 +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 cdc57db3b3 Fix race conditions 2020-11-04 01:24:26 +00:00
xuri c82a185af8
Compatibility improvement: parse document core part (workbook) dynamically 2020-11-04 00:28:20 +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 324f87bcae
add checking and limits for the worksheet 2020-09-18 22:20:58 +08:00
xuri 88de2f8d51
Default row height compatibility with Apache OpenOffice and Kingsoft WPS, unit test update and typo fixed 2020-08-22 18:58:43 +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 c922c32fb7
support parse and generate XML element namespace dynamic, fix #651 2020-07-18 15:15:16 +08:00
xuri 820a314cfb
Resolve #667, support shared string table without unique count 2020-07-15 23:32:00 +08:00
xuri 49257c5918
support case-sensitive doc parts to improve compatibility 2020-07-09 01:24:11 +08:00
xuri f7bd0729c6
Resolve #32, fix missing leading/leading spaces when working with SST 2020-07-01 22:41:29 +08:00
xuri 1cbb05d497
GetCols support the row element without r attribute in the worksheet 2020-06-28 00:02:32 +08:00
xuri 48f19f60aa
support the row element without r attribute in the worksheet 2020-06-27 00:02:47 +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 c168233e70
speedup get cell value from shared string table 2020-05-27 00:02:29 +08:00
xuri 5c99300ee4
Fix #622, storage string to SST (shared string table) 2020-05-26 02:09:39 +08:00
xuri 98221a332f
Merge pull request #410 2020-05-17 17:36:53 +08:00
xuri 2285d4dc71
handle the cell without r attribute in a row element 2020-04-24 08:26:16 +08:00
xuri 0f2a905324 Performance improvements 2020-04-05 13:51:00 +08:00
foxmeder 59f6af21a3 fix reading wrong string from xml such as below
<sheetData><row r="1"><c r="A1" s="1" t="s"><v>0</v></c><c r="B1" s="1" t="s"></c></row></sheetData>
2020-04-02 00:49:09 +08:00
xuri 3f89c6e979
remove ineffectual variable assignments and simplify code 2020-03-29 18:44:24 +08:00
xxb-at-julichina 386a42dfa2
Update rows.go 2020-02-28 15:53:04 +08:00
xuri 8b20ea1685
Fix #586, duplicate row with merged cells 2020-02-25 00:19:22 +08:00
xuri ad883caa0f
Resolve #580, revert commit 5ca7231ed4 2020-02-19 00:08:10 +08:00
xuri 5ca7231ed4
optimize code and comments: use println errors instead of panic 2020-01-03 23:57:25 +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
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 5d8365ca17
Fix #529, handle empty inline rich text 2019-12-11 00:02:33 +08:00
xuri 7965e1231b
Resolve #146, make the GetRow function read data as streaming. Ref: #382, #515 2019-11-23 04:13:59 +08:00
ducquangkstn 866fda2300 fix #503 rows next issue 2019-10-18 14:57:35 +08:00
xuri a34d3b8c86
Compatibility improvement 2019-09-24 21:53:19 +08:00
xuri 9c70d0ac86
Documentation updated, Go 1.10+ required 2019-08-11 00:36:14 +08:00
Harris acd76425c2
Handle multi row inline strings
The inline string struct is actually the same
as the shared strings struct, reuse it.

Note that Go version 1.10 is required.

Fixes #462
2019-08-09 08:12:08 -05:00
Harris e07581e980
Further improve read performance
Instead of re-encoding the full sheet to change the namespaces
in the encoded bytes, read the sheet again and do the byte
replacements there.

In this case, file access ends up being more performant than
marshaling the sheet back to XML.

In the SharedStrings test, ensure the strings are actually read.

Fix #439
2019-08-07 08:06:40 -05:00
Harris ac91ca0ded
Only parse xml once when reading
We were parsing the whole sheet twice since the
sheet reader already reads in all the rows.

getTotalRowsCols function is unused after these changes
so it has been deleted as well.

Closes #439
2019-08-05 08:50:45 -05:00
xuri 9f8623047d
Optimize code, fix golint issues 2019-06-20 00:00:40 +08:00
xuri 821632cf89
Fix #424, refactor merged cells adjuster 2019-06-12 08:10:33 +08:00
xuri 421f945f51
Fixed #418, #420, #421, init adjust calculation chain support
Update testing case
2019-06-08 00:00:55 +08:00
xuri 0660f30cdd
godoc update and typo fixed 2019-04-20 14:57:50 +08:00
Michael 0f9170a03b Resolve #382, rewrite prepareSheetXML to scale linearly (#383)
* Rewrite prepareSheetXML to scale linearly

We don't need to backfill columns into every row for most purposes
Provided makeContiguousColumns for setting styles where we do
need it for a specific region.

Added a benchmark to monitor progress. For 50,000 rows this went
from about 11 seconds to 1 second. The improvements are more
dramatic as the row/column count increases.

* Assigning that row value was redundant
2019-04-16 14:50:16 +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 4e7d93a777
Resolve #377, avoid empty column in GetRows result 2019-04-07 14:04:41 +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 7d197c6d89 Fixed PR #356 regression RemoveCol() broken (#365) 2019-03-21 18:44:30 +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
caozhiyi b974df402a update go test and function docs 2019-03-07 16:03:31 +08:00
Kimxu 164a3e126a update README and functions docs (#351)
* update README and functions docs

* update README and functions docs
2019-03-07 15:13:32 +08:00
Veniamin Albaev 12c1e2481e Implement consistent row addressing by Excel row number starting with 1 (#350)
* Implement consistent row addressing by Excel row number starting with 1

1. Added second versions for all row manipulation methods with zero-based row addressing.
2. Fixed methods documentation to explicitly describe which row addressing used in method.
3. Added WARNING to README.md.
4. Cosmetic change: All row test moved to file `rows_test.go`.

* TravisCI: go1.12 added to tests matrix

* BACKWARD INCOMPARTIBLE: Use only Excel numbering logic from 1 row

* README updated
2019-03-06 21:40:45 +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
Rafael Barros dea7ba0ec4 Fixes #195: Make GetRows return value avoid empty cell
* #195: proposed resolution to the issue

* Make GetRows return value avoid empty cell

* Update test file to fix broken testing.
2019-01-01 18:18:42 +08:00
xuri fabd9d013f
README updated 2019-01-01 13:20: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 90bdd3632f
Fix the issue caused by missing tradition to strict conversion for `sharedStringsReader()`, relate issue #276 2018-10-18 10:23:08 +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 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 eb62256d16
Simplify testing code, add test case for outline functions and update the godoc. 2018-05-11 10:14:18 +08:00