Commit Graph

188 Commits

Author SHA1 Message Date
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
heiy eb150c0c22 escape html tag 2020-06-08 18:23:38 +08:00
xuri 2ae631376b
add limits for total columns, row and filename length 2020-05-29 00:26:40 +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 ec14de32f0
Merge branch 'master' into fix/cell_lock 2020-05-22 16:53:46 +08:00
xuri 882abb8098
- formula engine: reduce cyclomatic complexity
- styles: allow empty and default cell formats, #628
2020-05-10 16:56:08 +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 e36650f4ff
Resolve #598, filter support for AddPivotTable 2020-04-09 01:00:14 +08:00
xuri 66d0272f6a
Resolve #172, init rich text support 2020-04-06 00:23:27 +08:00
xuri 09485b3f9f
Improve code coverage unit tests 2019-12-29 16:02:31 +08:00
Cameron Howey 5c87effc7e Stream to Excel table (#530)
* Support all datatypes for StreamWriter

* Support setting styles with StreamWriter

**NOTE:** This is a breaking change. Values are now explicitly
passed as a []interface{} for simplicity. We also let styles to be
set at the same time.

* Create function to write stream into a table

* Write rows directly to buffer

Avoiding the xml.Encoder makes the streamer faster and use less
memory.

Using the included benchmark, the results went from:

> BenchmarkStreamWriter-4   514  2576155 ns/op  454918 B/op  6592 allocs/op

down to:

> BenchmarkStreamWriter-4  1614   777480 ns/op  147608 B/op  5570 allocs/op

* Use AddTable instead of SetTable

This requires reading the cells after they have been written,
which requires additional structure for the temp file.

As a bonus, we now efficiently allocate only one buffer when
reading the file back into memory, using the same approach
as ioutil.ReadFile.

* Use an exported Cell type to handle inline styles for StreamWriter
2019-12-29 12:45:10 +08:00
xuri 5f3a4bc39f
Fix #538, added setting a major unit and tick label skip support for the chart 2019-12-25 00:00:50 +08:00
xuri 4e4a5b9b3e
Improve compatibility, fix workbook's rels ID calc error 2019-12-23 00:07:40 +08:00
xuri da0d2ffbb6 Fix #533, add support overlapped mergecells 2019-12-14 19:57:37 +08:00
马彦军 aa7eadbffe fix go lock 2019-11-14 14:30:25 +08:00
xuri 2e791fa433 Optimize code of Getting/Setting Page Margins 2019-10-17 00:02:39 +08:00
heiy 810139f5fc solve ending space missing 2019-10-10 20:04:33 +08:00
Christian Fiedler 3280e1b686 Allow access to more formula attributes in SetCellFormula (#484)
* Allow access to more formula attributes in SetCellFormula

Make SetCellFormula variadic to not break API.
The new arguments are option arguments in which the type of
the formula and the ref attribute may be set.
These need to be set for an array formula to work.

* Add TestWriteArrayFormula to test optional parameters of SetCellFormula

TestWriteArrayFormula writes a document to the test directory that
contains array formulas that are used to calculate standard deviations.
The file also contains values calculated by the Go testcase, so the
results can be verified. It should be tested, if the array formula
works (i.e. shows a number, not an error) and that the values calculated
by the formula and those calculated by Go are the same.
2019-09-22 20:52:01 +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
mqy 64809db2c9 add missing error check in SetSheetRow() 2019-08-19 15:53:56 +08:00
Olivier Mengué ac395a60ed SetCellValue: use fmt.Sprint(v) instead of fmt.Sprintf("%v", v)
Because that does the same thing, but without having to parse a format
string.

Signed-off-by: Olivier Mengué <dolmen@cpan.org>
2019-08-13 15:57:35 +02:00
xuri 9c70d0ac86
Documentation updated, Go 1.10+ required 2019-08-11 00:36:14 +08:00
xuri 821632cf89
Fix #424, refactor merged cells adjuster 2019-06-12 08:10:33 +08:00
xuri b45c4b094c Add a check for maximum limit hyperlinks in a worksheet
typo fixed
2019-04-21 00:20:19 +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 c423617e9d
Check max length for SetCellStr and fix coordinate issue for MergeCell 2019-04-14 12:55:44 +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
xuri 70b1a29165
Use bitSize for float32 type numbers conversion, relate PR #361 2019-03-21 14:09:25 +08:00
Michael b2c12d784e SetCellFloat for floats with specific precision (#361)
This allows the user to set a floating point value into a
cell with a specific number of places after the decimal.

Closes #357
2019-03-21 11:41:46 +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 0072bb7310
resolve the issue corrupted xlsx after deleting formula of cell, reference #346 2019-02-22 22:17:38 +08:00
xuri fabd9d013f
README updated 2019-01-01 13:20:14 +08:00
peiqi ef334ee658
fix issue #290 2018-11-08 11:43:29 +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 aaced358f1
- Initialize shared formula types support, relate issue #227;
- go test and godoc has been updated
2018-05-26 16:23:15 +08:00
Ri Xu 564ebe48dd
- Fix `checkCellInArea()` index out of range when merged cell ref is single coordinate, relate issue #206;
- go test updated;
- Repository icon for SourceTree has been added
2018-04-08 10:31:11 +08:00
Ri Xu 770026e956
- New function `SetSheetRow()` has been added for support write whole line at once, relate issue #96 and #194;
- go test and godoc updated;
- Note that this function performance has not been tested
2018-03-12 20:14:39 +08:00
dvelderp b25ec6e9d3 xlsx.SetCellValue() now supports bool value 2018-01-25 18:08:26 +01:00
mbresson 317ef65381 make SetCellStyle quicker by skipping conversions in checkCellInArea, and skipping area checks when we are sure the cell can't be before or past the current row/col
Signed-off-by: Matthieu Bresson
2018-01-19 17:49:09 +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
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 b4ffa8ce48
- Add unsigned integer data type support, related issue #136;
- go test and godoc updated

Signed-off-by: Ri Xu <xuri.me@gmail.com>
2017-10-18 18:42:20 +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 e820388d70
Handle coordinate parse exception, relate issue #122. 2017-09-19 11:59:33 +08:00
Ri Xu b7b937a8a3
godoc updated. 2017-09-13 22:17:40 +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 574a6b20d1
Golang 1.9 compatible, fix issue #111 2017-09-01 12:59:15 +08:00
Ri Xu a8cf38ebd5
- New function `GetCellHyperLink()` added, relate issue #98;
- go test added
2017-08-08 20:08:54 +08:00
Takayuki Usui 88d10ff27b Fix round-off error in representation of date and time values 2017-07-31 09:33:48 +09:00
Ri Xu 308776e350
Optimize code, go test and godoc updated. 2017-07-30 15:46:04 +08:00
Youngwan Kim 5a4870d1cf Add extra argument "Linktype" to SetCellHyperLink
it support "External" and "Location"

Signed-off-by: Youngwan Kim <y103.kim@gmail.com>
2017-07-30 15:46:58 +09:00
Ri Xu 8493fea373
- Add number format code with unicode values, relate issue #86;
- godoc updated
2017-07-26 18:37:00 +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 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 dea57dd0ae Code optimize. 2017-05-24 14:17:35 +08:00
Ri Xu 66349f8ec0 Handle number formats out of built-in range exception by returning raw value, relate issue #50. 2017-05-05 19:15:39 +08:00
Ri Xu 8fbab47444 - Formatted cell data support, fix issue #48;
- Function `SetCellValue()` support `time.Time` data type parameter, relate issue #49;
- go doc and go test updated
2017-05-05 14:40:28 +08:00
Ri Xu de6e075713 Performance improvement 2017-03-12 20:38:26 +08:00
Ri Xu 5384756d64 - Complete the element `sheetFormatPr` struct definition;
- Partial logic performance optimization, use pointer reference instead of a pass the variable value;
- Add comments for content types struct definition;
- Update go test `TestSetBorder` section
2017-03-10 23:10:15 +08:00
Ri Xu 1f73f08185 - New feature: border setting support (Related issue #21);
- Function parameter code is simplified;
- Fix element `Tint` value parsing error in worksheet;
- Update go test
2017-03-06 12:05:41 +08:00
Ri Xu 0833a9d5da - Improved performance when reading large files, call Token to read tokens one by one instead Unmarshal. Related issue #20 ;
- Fix go test typo;
- Update README
2017-02-12 19:03:24 +08:00
Ri Xu a1060e779e Make functions: `SetCellValue`, `SetCellInt`, `SetCellHyperLink`, `SetCellFormula`, `GetCellValue` and `GetCellFormula` to support the merged cells. 2017-01-25 18:13:11 +08:00
Ri Xu c0a3020886 Support create merge cell. 2017-01-25 15:44:18 +08:00
Ri Xu 9559f454a7 Fix issue #17, update README and fix typo. 2017-01-23 16:15:01 +08:00
Ri Xu 4a9b39afc6 - Add hyperlink and set formula support for cell support;
- Character limits for cells added;
- Update go test and fix typo
2017-01-19 14:05:32 +08:00
Ri Xu 52796f6e58 Format commants, break comments after 80 characters. 2017-01-18 16:05:01 +08:00
Ri Xu f05df2a018 - New function `SetSheetName` and `SetColWidth` added, support rename sheet and set column width;
- Add escape characters of sheet name;
- Update go test and fix typo
2017-01-18 14:47:23 +08:00
Ri Xu 30d0a2f40a - New function `GetCellFormula` added;
- Fix `GetCellValue` causes panic in some particular situation issues;
- Go test updated
2016-12-24 22:47:36 +08:00
Ri Xu 75abc628fe Update godoc of package. 2016-10-19 20:39:44 +08:00
Ri Xu 2e8fa2d39c Use conjunction with strings.Map to split Axis and update godoc. 2016-09-12 17:37:06 +08:00
Ri Xu 50863294f9 Fix issue #2 change project to object-oriented style and update readme file. 2016-09-05 16:37:15 +08:00
Ri Xu 956a4627d1 Fix issue #4 use builtin `map` instead of home-built. 2016-09-05 10:44:32 +08:00
Ri Xu 192af02a40 Format code with golint rules 2016-09-02 11:54:52 +08:00
Ri Xu 3c4ad28db7 - Get cell value support
- Optimisation code use fmt package
- Update README
- Remove useless function
2016-08-30 21:54:28 +08:00