Commit Graph

161 Commits

Author SHA1 Message Date
xuri ebea684ae5
Fix potential file corrupted and change worksheet name case-insensitive
- Using sheet ID instead of sheet index when delete the cell in calculation chain
- Update documentation for exported functions
- Using `sheet` represent the sheet name in the function parameters
2022-07-18 00:21:34 +08:00
Eng Zer Jun 6bcf5e4ede
refactor: replace strings.Replace with strings.ReplaceAll (#1250)
strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-06-12 00:19:12 +08:00
xuri 8f16a76781
This fixes a part of staticcheck issues and updates the code of conduct
Update example for set cell hyperlinks with `HyperlinkOpts`
2022-05-18 23:15:24 +08:00
xuri c2311ce87d
This made library allowing insert WMF format image 2022-05-14 00:54:36 +08:00
xuri 0c3fd0223c
This closes #1225, allowing insert EMF format images 2022-05-13 01:03:40 +08:00
xuri 856ee57c40
This closes #1212, init support for 1900 or 1904 date system 2022-04-30 09:54:11 +08:00
xuri 6fa950a4f8
ref #65, new formula functions: SKEW.P and SLOPE, remove no-required format default 2022-04-16 13:53:16 +08:00
xuri 8a335225c7
Format code, update documentation and remove exported variable `XMLHeaderByte` 2022-03-24 00:19:30 +08:00
xuri f87c39c41d
This closes #1148, resolve limitations when adding VBA project to the workbook
Added two exported functions `SetWorkbookPrOptions` and `GetWorkbookPrOptions` to support setting and getting the code name property of the workbook
Re-order fields of the workbook properties group to improve the compatibility
Go Modules dependencies upgrade
Put workbook related operating in new `workbook.go` source code
Library introduction docs block updated
2022-02-17 00:09:11 +08:00
xuri 3ee3c38f9c
Fix file corrupted in some cases, check file extension and format code
Fix file corrupted when save as in XLAM / XLSM / XLTM / XLTX extension in some case
New exported error ErrWorkbookExt has been added, and check file extension on save the workbook
Format source code with `gofumpt`
2022-01-23 00:48:26 +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 bc3c7d51a2
ref #65: new formula function PRICE
- fix COUPPCD result accuracy issue
- update close spreadsheet example in documentation and README
2021-11-17 00:25:36 +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 52609ba526
This closes #1017, fix duplicate image caused by incorrect internal relationships ID calculation 2021-09-10 23:19:59 +08:00
xuri 7d9b9275bd
This closes #1012, support specify the formula in the data validation range, and update the documentation for the `AddPicture` 2021-08-26 00:48:18 +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
three f6f14f507e
Speed up merge cells 2021-08-13 01:32:44 +08:00
xuri 43a057b1ea
This closes #986, fix set data validation drop list failed in some cases
Update documentation for `GetCellValue` and simplify code
2021-08-12 00:02:27 +08:00
xuri e9ae9b45b2
change go module import path to github.com/xuri/excelize 2021-07-28 00:38:09 +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 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 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 77978ac68d
This closes #657 and closes #748, AddChart support custom marker symbol and symbol size, fix AddPicture auto fit failure with multi merged cells 2020-12-14 20:56:51 +08:00
Zhang Zhipeng ad79505173
new formula func CLEAN and TRIM, change import path to v2 (#747) 2020-12-14 09:56:42 +08:00
xuri 2514bb16c6 Fix #724, standardize variable naming and update unit tests 2020-11-11 01:03:56 +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 3c8c8c55c8 resolved #691, fix the scale for add picture not work 2020-08-18 08:30:32 +00:00
xuri c922c32fb7
support parse and generate XML element namespace dynamic, fix #651 2020-07-18 15:15:16 +08:00
xuri 0aa1510694
update docs and improve compatibility 2020-07-11 02:31:02 +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 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 98221a332f
Merge pull request #410 2020-05-17 17:36:53 +08:00
Olivier Mengué 6e90fa6b1d
Replace bytes.NewReader(stringToBytes(s)) with strings.NewReader(s) (#610) 2020-04-09 00:49:13 +08:00
xuri 66d0272f6a
Resolve #172, init rich text support 2020-04-06 00:23:27 +08:00
xuri 0f2a905324 Performance improvements 2020-04-05 13:51:00 +08:00
xuri 6afc468a02
Resolve #451, support create chart sheet 2020-03-28 23:47:26 +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 cbc3fd21b7
Resolve #455, init delete picture from spreadsheet support 2020-01-22 01:08:18 +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 ae2865d923
Improve code coverage unit tests 2019-12-22 00:02:09 +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 eb520ae277
Improve compatibility for charts 2019-09-26 22:28:14 +08:00
xuri a34d3b8c86
Compatibility improvement 2019-09-24 21:53:19 +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 0acb3ef968
Testing files updated 2019-09-02 21:52:55 +08:00
xuri 9c70d0ac86
Documentation updated, Go 1.10+ required 2019-08-11 00:36:14 +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 9f8623047d
Optimize code, fix golint issues 2019-06-20 00:00:40 +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 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
Michael a94dcb9918
Do not save duplicate images
Adding the same image should create a drawing referencing the
already stored copy of the image.

Closes #359
2019-03-25 13:17:53 -05: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 677a22d994 resolve #366 fix image duplication 2019-03-22 14:37:59 +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 1aed1d744b
Resolve #274, performance optimization for add images, charts and shapes 2019-02-25 22:14:34 +08:00
xuri fabd9d013f
README updated 2019-01-01 13:20:14 +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 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
Farmerx ce5b37a4ac
# fix : file close 没有关闭 2018-08-20 16:53:51 +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
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
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 06e54bf1c6
Readme and godoc has been updated. 2018-03-06 10:36:12 +08:00
Ri Xu 7621927573
- Add a hyperlink to an image support for the function `AddPicture()`, relate issue #185;
- go test and document has been updated.
2018-02-03 15:02:37 +08:00
Jinzhu 21214a514d Rename import path to github.com/360EntSecGroup-Skylar/excelize 2017-11-16 11:07:39 +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 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 20aae4e0e6 Repo URI changed. 2017-07-11 14:54:47 +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
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 efff54ccde - Fixed coordinate parse error in function `SetCellStyle()`, relate issue #60;
- Simplified code
2017-06-12 18:05:09 +08:00
Ri Xu 7c3f91ada4 Fix non-visual canvas properties ID calculator. 2017-05-25 11:15:38 +08:00
Ri Xu dea57dd0ae Code optimize. 2017-05-24 14:17:35 +08:00
Ri Xu d93a156355 Initialize comments support & go test updated. 2017-05-13 13:28:21 +08:00
Ri Xu 7f30a6c943 - Initialize shape support: new function `AddShape()` added. Relate issue #38;
- Drawing `nvPicPr` element ID property calculation changed;
- go test updated
2017-04-30 20:03:43 +08:00
Ri Xu 46b8c46d91 - Initialize table support;
- go test updated
2017-04-28 15:49:41 +08:00
Ri Xu 219aadeb76 - Initialize char support, relate issue #31;
- Doc for function `GetRows()` updated, relate issue #43;
- Fix doc typo in `xmlContentTypes.go`;
- Default template updated;
- Readme updated;
- go test updated
2017-04-23 00:10:23 +08:00
Ri Xu 8fd061b98f - Fix SheetCount count error;
- Optimize deserialization operations;
- README updated, add go version required notice
2017-04-01 13:56:39 +08:00
Ri Xu 7ceb4f21ad Godoc updated. 2017-03-30 11:06:51 +08:00
Ri Xu 02b81b7efe - Get an images in a cell supported, new function `GetPicture` added;
- go test updated
2017-03-28 21:18:06 +08:00