Commit Graph

16 Commits

Author SHA1 Message Date
Lijingfeng 93160287bb
Optimize memory usage when stream flush and save (#659)
* use io.Copy from stream temp file to zip Writer

* fix nil

* log

* build

* delete log

* fix compatibility for office

* Update go module

Co-authored-by: lijingfeng <lijingfeng@laiye.com>
Co-authored-by: xuri <xuri.me@gmail.com>
2020-10-05 22:17:11 +08:00
xuri bc704c854f update stream writer fields offset 2020-08-15 10:41:45 +00: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
xuri 0aa1510694
update docs and improve compatibility 2020-07-11 02:31:02 +08:00
xuri 15fd56853f
Update docs and typo fixed 2020-06-22 00:14:56 +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 ad883caa0f
Resolve #580, revert commit 5ca7231ed4 2020-02-19 00:08:10 +08:00
xuri 023dba7265
Fix #576, serialize by fields order on stream flush 2020-02-13 00:00:42 +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
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 1666d04559
optimization: checking error in unit tests 2019-12-24 01:09:28 +08:00
xuri a526e90404
Fix #426, handle empty workbook view 2019-12-16 08:32:04 +08:00
xuri 08d1a86c3a
Fix #523, add stream writer for generate new worksheet with huge amounts of data 2019-12-10 00:16:17 +08:00