mjul / docjure

Read and write Office documents from Clojure
MIT License
619 stars 129 forks source link

The maximum number of Cell Styles was exceeded. You can define up to 64000 #79

Closed mauricioszabo closed 5 years ago

mauricioszabo commented 5 years ago

I'm trying to create a simple spreadsheet. The problem is that when I use date and date-times with docjure, it creates a "style" and fails with the exception above if the number of rows is too high.

The offending code is probably the following: https://github.com/mjul/docjure/blob/master/src/dk/ative/docjure/spreadsheet.clj#L225

mjul commented 5 years ago

Thanks for catching this. If you have a fix, it will be much appreciated. For a future 2.0 version I would like to make the formatting much more functional than the imperative style used currently, so we could avoid this kind of issue altogether. Best regards, Martin

mauricioszabo commented 5 years ago

I think one possible fix would be to pass a "style cache" to set-cell!.

Problem is that we'll need to carry this cache between multiple functions (mainly add-rows!, add-row!, and set-cell!). I could use a multi-arity approach so we would not break compatibiliity, do you think it's a good approach?

mauricioszabo commented 5 years ago

Any chance of reviewing my pull request, so we can close this issue?