Commit Graph

40 Commits

Author SHA1 Message Date
xuri 93c72b4d55
This optimizes internal functions signature and mutex declarations 2023-04-24 00:02:13 +08:00
xuri dc3bf331d5
Breaking change: changed the third parameter for the `AddFilter`
- Support to add multiple filter columns
- Remove the exported type `AutoFilterListOptions`
- Support to specify if show header row of the table
- Update unit tests and documents of the function
2023-03-04 00:07:04 +08:00
xuri b39626fae9
This fixed worksheet protection issue
- Update example code in the documentation
- Update unit tests
- Rename `PictureOptions` to `GraphicOptions`
- Adjust partial options fields data types for the `PictureOptions` and `Shape` structure
- Update dependencies module
2023-01-02 11:47:31 +08:00
xuri 45d168c79d
This closes #1391, escape XML characters to avoid with corrupt file
- Update and improve unit test coverage
2022-11-15 22:08:37 +08:00
xuri 58b5dae5eb
Support update column style when inserting or deleting columns
- Go Modules dependencies upgrade
- Unify internal variable name
- Unit test updated
2022-11-11 01:50:07 +08:00
xuri adf9d37d82
This closes #1379, cleanup stream writer temporary files by the `Close` function
- Fix error on inserting columns or rows on the worksheet which contains one cell merged cell range
- Fix getting incomplete rich text cell value in some cases
- Unit tests updated
2022-10-26 00:04:23 +08:00
xuri efcf599dfe
This closes #1360, closes #1361
- Fix default number format parse issue with a long string of digits
- Fix creating a sheet with an empty name cause a corrupted file
- The `GetCellStyle` function no longer return master cell style of the merge cell range
- Using the specialized name in variables and functions
2022-09-28 00:04:17 +08:00
xuri 3f702999e6
Using the specialized name in a variable and making comments clear
- Add JSON tags for `AppProperties`, `PivotTableOption` and `PivotTableField` structure
2022-09-18 00:07:15 +08:00
xuri 0c5cdfec18
This closes #1293, add new function `GetColStyle`
- Fix generate workbook corruption after insert cols/rows in some case
- Update unit tests
- Update dependencies module
2022-09-07 00:18:16 +08:00
Kostya Privezentsev 18cd63a548
This is a breaking change closes #1332 (#1333)
This use `InsertRows` instead of `InsertRow`, and using `InsertCols` instead of `InsertCol`
2022-08-31 00:02:48 +08:00
xuri 551fb8a9e4
This closes #1244 and closes #1314, improving the compatibility with Google Sheet
- Format code with `gofmt`
2022-08-13 11:21:59 +08:00
xuri 40ed1d1b81
Fix potential file corrupted when changing cell value or the col/row
- Remove shared formula subsequent cell when setting the cell values
- Support adjust table range when removing and inserting column/row
2022-07-16 12:50:40 +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
Dokiy 67127883dd
Fix adjustMergeCells not modifies cell rect (#1118) 2022-01-14 00:28:31 +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
Dokiy 3325c3946d
Fix adjustMergeCellsHelper and add some test cases (#1082)
Signed-off-by: Dokiys <dokiychang@gmail.com>
2021-12-06 22:37:25 +08:00
three f6f14f507e
Speed up merge cells 2021-08-13 01:32:44 +08:00
xuri cf9fbafdd8
This closes #979, fix the data validation deletion issue and tidy the internal function in the source code 2021-08-06 22:44:43 +08:00
Deepak S ee8098037d
Prevent panic when incorrect range is provided as PivotTableRange to (#874) 2021-07-10 12:17:41 +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 1f329e8f96
This closes #774, closes #775 and closes #776
- correct adjust calculation chain in duplicate rows
- correct adjust defined name in the workbook when delete worksheet
- use absolute reference in the auto filters defined name to make it compatible with OpenOffice
- API `CoordinatesToCellName` have a new optional param to specify if using an absolute reference format
- Fix cyclomatic complexity issue of internal function `newFills` and `parseToken`
2021-02-02 22:23:16 +08:00
xuri 2514bb16c6 Fix #724, standardize variable naming and update unit tests 2020-11-11 01:03:56 +08:00
Wang Yaoshen c98fd7e5d0
Fix issue #686 RemoveRow slice bounds out of range (#687)
fix Hyperlinks update error
2020-08-14 10:32:58 +08:00
xuri 15fd56853f
Update docs and typo fixed 2020-06-22 00:14:56 +08:00
xuri 0f2a905324 Performance improvements 2020-04-05 13:51:00 +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 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
xuri 9c70d0ac86
Documentation updated, Go 1.10+ required 2019-08-11 00:36:14 +08:00
xuri 1092009541
Fixed doc corruption when deleting all merged cells 2019-08-03 23:10:01 +08:00
xuri 855c3605f6
Fix #437, recalculate offset for merged cells adjuster 2019-07-20 19:24:57 +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 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 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 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