Commit Graph

66 Commits

Author SHA1 Message Date
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
Ilya Kuznetsov e70618d084 Added functions to set and get outline level for columns and rows. 2018-05-07 21:47:31 +03:00
xuri d04be7b33d
Merge branch 'master' into lunny/refactor 2018-05-07 16:42:30 +08:00
Ri Xu 3ca180f09c
Merge test cases and use strict error checking. 2018-05-07 16:14:35 +08:00
Lunny Xiao 38ad20efc1
save bytes on memory instead of string 2018-05-07 16:12:51 +08:00
Lunny Xiao bc451a78de
add iterator method for rows 2018-05-05 13:33:19 +08:00
Ri Xu 9ee57fdb38
Fix typo and adding Chinese version document. 2018-04-23 00:14:58 +08:00
Ri Xu 2b97c3bb46
- Support to read inlineStr type cell value, relate issue #208, PR #209;
- go test and godoc has been updated
2018-04-09 19:44:08 +08:00
Ri Xu a6fc5a721d
- Make row index consistent in function `SetRowHeight` and `GetRowHeight`, fix issue #205;
- go test and godoc has been updated
2018-04-02 10:59:15 +08:00
Ri Xu b1b056e0eb
Handle special shared string table file name `xl/SharedStrings.xml`, relate issue #188 2018-03-02 10:19:40 +08:00
Ri Xu 6dc135a992
Fix read columns count wrong in specific xlsx data, relate issue #175 2018-01-06 08:05:43 +08:00
Ri Xu ebafbdde73
Bugfix: use sheet name in func `AddChat`, relate issue #138
Signed-off-by: Ri Xu <xuri.me@gmail.com>
2017-10-20 14:40:57 +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 e05867a033
Function `GetCellValue()` performance improvement by avoid repeating deserialization, relate issue #70. 2017-06-29 13:28:44 +08:00
Ri Xu 86466654e2
- Unify the index row number index of functions `SetRowHeight()` and `GetRowHeight()` relate issue #68;
- Unify the return value data type of functions  `SetColWidth()` and `GetColWidth()`;
- go test updated
2017-06-29 11:14:33 +08:00
Ri Xu 66e5d1fa80
API changed, use `NewFile()` instead of `CreateFile()` and use `SaveAs()` instead of `WriteTo()`. 2017-06-28 17:03:20 +08:00