File tree Expand file tree Collapse file tree 5 files changed +16
-30
lines changed Expand file tree Collapse file tree 5 files changed +16
-30
lines changed Original file line number Diff line number Diff line change 1
1
# Change Log
2
2
3
+ ## [ 1.3.3] - 2020-07-11
4
+ ### Fixed
5
+ - Bug where columns would only auto resize up until 'J'
6
+ - Unnecessary Rhizome dependency causing headaches in headless environments
7
+
3
8
## [ 1.3.2] - 2020-04-15
4
9
### Fixed
5
10
- Bug introduced in v1.3.1 where adjacent cells with width > 1 cause an
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ common sense styling.
8
8
9
9
Lein:
10
10
```
11
- [org.clojars.mjdowney/excel-clj "1.3.2 "]
11
+ [org.clojars.mjdowney/excel-clj "1.3.3 "]
12
12
```
13
13
14
14
- [ Getting Started] ( #getting-started )
Original file line number Diff line number Diff line change 1
- (defproject org.clojars.mjdowney /excel-clj " 1.3.2 "
1
+ (defproject org.clojars.mjdowney /excel-clj " 1.3.3 "
2
2
:description " Generate Excel documents & PDFs from Clojure data."
3
3
:url " https://github.com/matthewdowney/excel-clj"
4
4
:license {:name " Eclipse Public License"
5
5
:url " http://www.eclipse.org/legal/epl-v10.html" }
6
6
:dependencies [[org.clojure/clojure " 1.10.1" ]
7
7
[com.taoensso/tufte " 2.0.1" ]
8
- [rhizome " 0.2.9" ]
9
8
[org.apache.poi/poi-ooxml " 4.0.0" ]
10
9
[org.jodconverter/jodconverter-core " 4.0.0-RELEASE" ]])
Original file line number Diff line number Diff line change 104
104
105
105
106
106
(defn- write-rows!
107
- " Write the rows via the given sheet-writer, returning the number of rows
108
- written."
107
+ " Write the rows via the given sheet-writer, returning [ the number of rows
108
+ written, number of columns written] ."
109
109
[sheet-writer rows-seq]
110
110
(reduce
111
- (fn [n next-row]
111
+ (fn [[rows cols] next-row]
112
112
(doseq [cell next-row]
113
113
(let [{:keys [width height]} (dims cell)]
114
114
(poi/write! sheet-writer (data cell) (style cell) width height)))
115
115
(poi/newline! sheet-writer)
116
- (inc n) )
117
- 0
116
+ [ (inc rows) ( max cols ( count next-row))] )
117
+ [ 0 0 ]
118
118
rows-seq))
119
119
120
120
129
129
(with-open [w (poi/writer f)]
130
130
(doseq [[nm rows] workbook
131
131
:let [sh (poi/sheet-writer w nm)
132
- n -written (write-rows! sh rows)]]
132
+ [rows -written cols-written] (write-rows! sh rows)]]
133
133
; ; Only auto-size columns for small sheets, otherwise it takes forever
134
- (when (< n -written 2000 )
135
- (dotimes [i 10 ]
134
+ (when (< rows -written 2000 )
135
+ (dotimes [i cols-written ]
136
136
(poi/autosize!! sh i)))))
137
137
f))
138
138
Original file line number Diff line number Diff line change 58
58
(coerce-to-obj
59
59
workbook :font {:bold true :font-height-in-points 10}))))"
60
60
{:author " Matthew Downey" }
61
- (:require [clojure.string :as string]
62
- [clojure.reflect :as reflect]
63
- [rhizome.viz :as viz])
61
+ (:require [clojure.string :as string])
64
62
(:import (org.apache.poi.ss.usermodel
65
63
DataFormat BorderStyle HorizontalAlignment FontUnderline
66
64
FillPatternType)
344
342
(def default-tree-total-formatters
345
343
{0 {:font {:bold true } :border-top :medium }
346
344
1 {:border-top :thin :border-bottom :thin }})
347
-
348
- (defn example
349
- " If one wanted to visualize all of the nested setters & POI objects...
350
- Keep in mind that this requires $ apt-get install graphviz"
351
- []
352
- (let [param-type (fn [setter] (resolve (first (:parameter-types setter))))
353
- is-setter? (fn [{:keys [name parameter-types]}]
354
- (and (string/starts-with? (str name) " set" )
355
- (= 1 (count parameter-types))))
356
- setters (fn [class]
357
- (filter is-setter? (#'reflect/declared-methods class)))
358
- cell-style (first
359
- (filter #(= 'setCellStyle (:name %)) (setters XSSFCell)))]
360
- (viz/view-tree
361
- #(instance? Class (param-type %)) (comp setters param-type) cell-style
362
- :node->descriptor #(->{:label ((juxt :name :parameter-types ) %)}))))
You can’t perform that action at this time.
0 commit comments