File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 163163(defn tree-grid
164164 " Build a lazy sheet grid from `tree`, whose leaves are shaped key->number.
165165
166- E.g. (tree {:assets {:cash {:usd 100 :eur 100}}})
166+ E.g. (tree-grid {:assets {:cash {:usd 100 :eur 100}}})
167167
168168 See the comment form below this definition for examples."
169- [tree]
170- (let [ks (into [" " ] (keys (tree/fold + tree)))]
171- (table-grid ks (tree->rows tree))))
169+ ([tree]
170+ (let [ks (into [" " ] (keys (tree/fold + tree)))]
171+ (tree-grid ks tree)))
172+ ([ks tree]
173+ (let [ks (into [" " ] (remove #{" " }) ks)] ; ; force the "" col to come first
174+ (table-grid ks (tree->rows tree)))))
172175
173176
174177(comment
Original file line number Diff line number Diff line change 4141 (let [temp-file (io/file (temp " .xlsx" ))]
4242 (try
4343 (testing " Example code snippet writes successfully."
44+ (println " Writing example workbook..." )
4445 (write! example-workbook-data temp-file))
4546 (finally
4647 (io/delete-file temp-file)))))
5051 (let [temp-file (io/file (temp " .xlsx" ))]
5152 (try
5253 (testing " Example code snippet writes successfully."
54+ (println " Writing example template..." )
5355 (let [template (clojure.java.io/resource " uptime-template.xlsx" )
5456 new-data {" raw" (table-grid example-template-data)}]
5557 (append! new-data template " filled-in-template.xlsx" )))
You can’t perform that action at this time.
0 commit comments