File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed
Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 229229 [workbook]
230230 (open (write-pdf! workbook (temp " .pdf" ))))
231231
232- (defn example []
233- (quick-open
234- {" Tree Sheet"
232+ (def example-workbook-data
233+ {" Tree Sheet"
235234 (tree
236235 [" Mock Balance Sheet for the year ending Dec 31st, 2018"
237236 tree/mock-balance-sheet])
243242 {" Date" " 2018-03-01" " % Return" 0.07M " USD" 2100.66666666M }])
244243
245244 " Freeform Grid Sheet"
246- [[" First Column " " Second Column " {:value " A few merged " :width 3 }]
245+ [[" First" " Second" {:value " Wide " :width 2 } { :value " Wider " :width 3 }]
247246 [" First Column Value" " Second Column Value" ]
248247 [" This" " Row" " Has" " Its" " Own"
249- {:value " Format" :style {:font {:bold true }}}]]}))
248+ {:value " Format" :style {:font {:bold true }}}]]})
250249
250+ (defn example []
251+ (quick-open example-workbook-data))
251252
252253(comment
253254 ; ; This should open an Excel workbook
259260 (open (convert-pdf! (example ) (temp " .pdf" )))
260261
261262 ; ; Expose ordering / styling issues in v1.2.X
262- (quick-open {" Test" (table
263- (for [x (range 10000 )]
264- {" N" x, " N^2" (* x x), " N^3" (* x x x)}))})
263+ (quick-open {" Test" (table
264+ (for [x (range 10000 )]
265+ {" N" x, " N^2" (* x x), " N^3" (* x x x)}))})
265266
266267 ; ; Ballpark performance test
267268 (dotimes [_ 5 ]
Original file line number Diff line number Diff line change 11(ns excel-clj.core-test
22 (:require [clojure.test :refer :all ]
3- [excel-clj.core :refer :all ]))
3+ [excel-clj.core :refer :all ]
4+ [clojure.java.io :as io]))
45
56(deftest table-test
67 (let [data [{" Date" " 2018-01-01" " % Return" 0.05M " USD" 1500.5005M }
2930 [" " 5 2 ]
3031 [" Tree 2" nil nil ]
3132 [" Child" -2 -1 ]]))))
33+
34+
35+ (deftest example-test
36+ (let [temp-file (io/file (#'excel-clj.core/temp " .xlsx" ))]
37+ (try
38+ (testing " Example code snippet writes successfully."
39+ (write! example-workbook-data temp-file))
40+ (finally
41+ (io/delete-file temp-file)))))
You can’t perform that action at this time.
0 commit comments