Commit Graph

54 Commits

Author SHA1 Message Date
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 ae2865d923
Improve code coverage unit tests 2019-12-22 00:02:09 +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