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 229
229
[workbook]
230
230
(open (write-pdf! workbook (temp " .pdf" ))))
231
231
232
- (defn example []
233
- (quick-open
234
- {" Tree Sheet"
232
+ (def example-workbook-data
233
+ {" Tree Sheet"
235
234
(tree
236
235
[" Mock Balance Sheet for the year ending Dec 31st, 2018"
237
236
tree/mock-balance-sheet])
243
242
{" Date" " 2018-03-01" " % Return" 0.07M " USD" 2100.66666666M }])
244
243
245
244
" 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 }]
247
246
[" First Column Value" " Second Column Value" ]
248
247
[" This" " Row" " Has" " Its" " Own"
249
- {:value " Format" :style {:font {:bold true }}}]]}))
248
+ {:value " Format" :style {:font {:bold true }}}]]})
250
249
250
+ (defn example []
251
+ (quick-open example-workbook-data))
251
252
252
253
(comment
253
254
; ; This should open an Excel workbook
259
260
(open (convert-pdf! (example ) (temp " .pdf" )))
260
261
261
262
; ; 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)}))})
265
266
266
267
; ; Ballpark performance test
267
268
(dotimes [_ 5 ]
Original file line number Diff line number Diff line change 1
1
(ns excel-clj.core-test
2
2
(:require [clojure.test :refer :all ]
3
- [excel-clj.core :refer :all ]))
3
+ [excel-clj.core :refer :all ]
4
+ [clojure.java.io :as io]))
4
5
5
6
(deftest table-test
6
7
(let [data [{" Date" " 2018-01-01" " % Return" 0.05M " USD" 1500.5005M }
29
30
[" " 5 2 ]
30
31
[" Tree 2" nil nil ]
31
32
[" 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