Commit Graph

192 Commits

Author SHA1 Message Date
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 b812e9a1a8
New formula function AND (#701) and update doc for the NewSheet (#714) 2020-10-22 08:29:25 +08:00
xuri 4834a058aa
This closes #714 and closes #715, fix wrong worksheet index returned by NewSheet in some case, fix panic on formatted value with no built-in number format ID 2020-10-19 23:55:54 +08:00
xuri 520aa679f3
Fix #706, #713 improve AddPicture performance, fix missing worksheet when rename with same names 2020-10-18 00:01:33 +08:00
xuri ac3dce0bea
- Resolve #711, update docs for the GetSheetIndex
- Update unit test
2020-10-12 00:05:27 +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 843bd24e56 This closes #677 and closes #679, fix panic when enabling compiler inline flags 2020-08-06 05:58:40 +00:00
xuri c922c32fb7
support parse and generate XML element namespace dynamic, fix #651 2020-07-18 15:15:16 +08:00
jaby 5993a07422
Fix issue 665 (#666) 2020-07-14 23:05:43 +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 dfea8f96ed
- New API: SetSheetFormatPr and GetSheetFormatPr
- typo fix, resolve #635
2020-05-12 23:26:26 +08:00
xuri 48fc4c08a2
init formula calculation engine, ref #65 and #599 2020-05-03 18:44:43 +08:00
xuri 2285d4dc71
handle the cell without r attribute in a row element 2020-04-24 08:26:16 +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 1d87da57ec
Resolve #492, init support for insert and remove page break 2020-03-01 00:34:41 +08:00
xuri ad883caa0f
Resolve #580, revert commit 5ca7231ed4 2020-02-19 00:08:10 +08:00
xuri e51aff2d95 Resolve #570, flat columns for the column's operation 2020-02-07 00:53:38 +08:00
xuri 5ca7231ed4
optimize code and comments: use println errors instead of panic 2020-01-03 23:57:25 +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
xuri ae2865d923
Improve code coverage unit tests 2019-12-22 00:02:09 +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 a526e90404
Fix #426, handle empty workbook view 2019-12-16 08:32:04 +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
xuri 7965e1231b
Resolve #146, make the GetRow function read data as streaming. Ref: #382, #515 2019-11-23 04:13:59 +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 5e418ebd66
Resolve #507, add the new function `DeleteDefinedName` 2019-10-26 20:55:24 +08:00
xuri e7581ebf3e
Fix corrupted Excel file issue #413 2019-10-23 10:08:29 +08:00
xuri 2e791fa433 Optimize code of Getting/Setting Page Margins 2019-10-17 00:02:39 +08:00
streboryaj 2d21b5b50f Added accessors for Getting/Setting Page Margins (#497)
* Added accessors for Getting/Setting Page Margins

* Added test cases
2019-10-15 22:26:08 +08: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
Harris faaaa52cb8
Get sheet names based on index
SheetID only seems to indicate the file name for the sheet.
Check the sheets list based on index instead. Reordering sheets
in Excel changes the order they appear in that list.

Fixes #457
2019-08-08 08:19:18 -05:00
xuri cbe919fdf6
New feature: sparkline supported 2019-08-04 20:24:59 +08:00
xuri b5f7d4a78e
Merge pull request #447 from dongkai16z/master
Fix #443
2019-07-26 09:21:25 +08:00
Sustainedhhh 0c9e5137e3
Fix #442 2019-07-25 20:31:21 +08:00
董凯 53e653f28e
Fix #443 2019-07-25 20:27:03 +08:00
xuri e14d2febc8
Resolve #432, supplement the function of SetPageLayout
SetPageLayout support to set fit to width and height
2019-07-06 15:11:51 +08:00
xuri 8b2d4cb697
New feature: group and ungroup sheets support
New functions `GroupSheets` and `UngroupSheets` added
Refactor sheet index calculation
2019-07-03 00:50:10 +08:00
xuri dc8210d4a7
Update GoDoc and typo fixed 2019-06-30 19:50:47 +08:00
xuri a335be7e4e
New functions: SetDefinedName and GetDefinedName added 2019-06-18 23:07:44 +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 f91f548614
Resolve #404, get sheet map by target rels. 2019-05-17 22:58:12 +08:00
xuri 69b38ddcd6
Resolve #394, init set header and footer support 2019-05-05 16:25:57 +08:00
xuri 01a418bda8
Resolve #392, compatible with strict relations name space inspection 2019-04-27 23:40:57 +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 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
Aplulu 841ff4a03e Fix out of range panic when removing formula.
Fix file corruption issue when deleting a sheet containing a formula.
2019-04-09 23:31:12 +09: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
Michael 2874d75555 Add benchmark for adding images to sheet (#367)
* Add benchmark for adding images to sheet

This should help track performance regressions in future changes.

* Only transform sheet name if necessary
2019-03-23 16:09:48 +08:00
xuri 40ea8eb014
resolve #360, fix axis parse issue when add / get pictures;
typo fixed and go test updated
2019-03-20 16:52:33 +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 0072bb7310
resolve the issue corrupted xlsx after deleting formula of cell, reference #346 2019-02-22 22:17:38 +08:00
kkxkkxkkgh 81948d9e1e The function SetPageLayout support set paper size 2019-01-13 21:58:50 +08: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
r-uchino 9b8baf75ad Add RegSearchSheet (#316) 2018-12-26 13:30:59 +08:00
xuri e728ff1498
Fixes #308, refactor `NewSheet()`, `DeleteSheet()`, `SetActiveSheet()` and `GetActiveSheetIndex()` 2018-12-15 00:08:55 +08:00
xuri 81b43da7b6 Fix comments according to best practices by effective go 2018-12-11 15:05:15 +13:00
xuri b89f75c896
Add new logo for excelize 2018-12-05 00:27:19 +08:00
taomin597715379 1bb59f75ea resolve #297, fix GetSheetMap() failed
Change-Id: I585a4a017867b89bd39cb6e711467a46eaa757be
2018-11-24 21:27:29 +08:00
q523591 51857a217d New function `UnprotectSheet()` has been added 2018-11-04 23:14:43 +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
peng e2e58a3a44 New function: `SearchSheet()`, relate issue #277 2018-10-27 14:19:54 +08:00
xuri 1c45425f12
resolve #276, add OfficeOpenXML-XMLSchema-Strict mode support 2018-10-17 00:28:31 +08:00
xuri 204139739a
Merge branch 'master' into master 2018-09-27 23:40:00 +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 6ced438f39
New function `AddPictureFromBytes()` has been added, this resolve #259 and close #271. 2018-09-14 00:24:49 +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 a3571ee39b
Bugfix: create worksheet cause file issue. Relate issue #249. 2018-07-17 15:28:22 +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
Sebastian Willing ccdefb3b16 Documentation:
* Add information about return value of NewSheet()
* Minor documentation language fixes
Samples:
* Added sample go file for dumping a XLSX file to the console
2018-06-11 17:25:28 +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
xuri d96440edc4
- Performance optimization 20% faster, 14% memory savings on set cell values;
- Using the canonical syntax in issue template and contributing guide;
- go test has been updated
2018-05-15 21:00:56 +08:00
xuri 167554bfec
Improve unit testing, remove redundant code. 2018-05-14 10:12:46 +08:00
Lunny Xiao 38ad20efc1
save bytes on memory instead of string 2018-05-07 16:12:51 +08:00
Ri Xu 200437d778
Fix document typo. 2018-05-03 10:01:41 +08:00
Ri Xu a9c7d6637c
- Support to set the positioning of a picture, relate issue #214;
- go test and godoc has been updated
2018-04-26 11:41:13 +08:00
Ri Xu d65b30055d
- Update the function `NewSheet()` to handle when already exists a worksheet of the same name, relate pull request #196;
- go test and godoc has been updated
2018-03-16 20:54:07 +08:00
Ri Xu 06e54bf1c6
Readme and godoc has been updated. 2018-03-06 10:36:12 +08:00
Ri Xu 749d12eece
- Fix `DeleteSheet()` make broken file, relate issue #165;
- godoc updated
2017-12-04 23:54:32 +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
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 905be463ed
Improve code readability. 2017-09-30 17:07:59 +08:00
Ri Xu b7b937a8a3
godoc updated. 2017-09-13 22:17:40 +08:00