mjul / docjure

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

Prototype and test idea #59

Open tombooth opened 7 years ago

tombooth commented 7 years ago

I've thrown together a little something that tests a couple of cases. Please comment on this, definitely less than ideal!

58

mjul commented 7 years ago

Hi Tom,

thanks for writing this. What are the things you consider "less than ideal"?

Would it look better, if we rethought the API for a more fluent compositional style instead of staying close to the V1 API?

The fonts and styles are not the highest priority, but I think they can be rewritten in a better style with the new API by e.g. assigning a name (e.g. :headline) when creating them. This could be stored in the Clojure state map and the the symbolic name could then be used to access them when they are applied.

mjul commented 7 years ago

On a further note, I think we could provide sensible defaults to the functions, for example, the -seqfunctions would not need to require more than a workbook. We could have a cursor concept and set it to default to the first cell of the first row of the first sheet: :cursor {:row 1, :cell :a, :sheet "Sheet1"} and then se that as a reference: row-seq would then enumerate the rows of the current sheet selected by the :cursor :sheet (navigating there in the POI instance as needed) so we would not need all the assert about where we are etc.

mjul commented 7 years ago

PS: please submit pull requests for this against the v2 branch, not the master.