Skip to content

Commit fed11ae

Browse files
committed
Bumped to 1.6.0-SNAPSHOT, merged changes from mva, added tests for set-cell!
1 parent 4ce9805 commit fed11ae

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG for Docjure
22

3+
## Version 1.6.0-SNAPSHOT
4+
* Upgraded to Clojure 1.3 (contributed by mva)
5+
* Use type hints to call correct overload for setting nil date (contributed by mva)
6+
37
## Version 1.5.0
48
* Introduces remove-row! and remove-all-rows!.
59
* Adds row-vec function to create row data for adding to sheet from a struct to ease writing select, transform, write-back tasks.

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ The Docjure jar is distributed on [Clojars](http://clojars.org/dk.ative/docjure)
4343
If you are using the Leiningen build tool just add this line to the
4444
:dependencies list in project.clj to use it:
4545

46-
[dk.ative/docjure "1.4.0"]
46+
[dk.ative/docjure "1.6.0-SNAPSHOT"]
4747

4848
Remember to issue the 'lein deps' command to download it.
4949

50-
#### Example project.clj for using Docjure 1.4
50+
#### Example project.clj for using Docjure 1.5.0
5151

5252
(defproject some.cool/project "1.0.0-SNAPSHOT"
5353
:description "Spreadsheet magic using Docjure"
54-
:dependencies [[org.clojure/clojure "1.1.0"]
55-
[org.clojure/clojure-contrib "1.1.0"]
56-
[dk.ative/docjure "1.4.0"]])
54+
:dependencies [[org.clojure/clojure "1.2.0"]
55+
[org.clojure/clojure-contrib "1.2.0"]
56+
[dk.ative/docjure "1.5.0"]])
5757

5858

5959
## Installation
@@ -99,6 +99,6 @@ Martin Jul
9999
## Contributors
100100
This library includes great contributions from:
101101

102-
* [Carl Baatz](https://github.com/cbaatz)
103-
102+
* [Carl Baatz](https://github.com/cbaatz) (cbaatz)
103+
* [Michael van Acken](https://github.com/mva) (mva)
104104

project.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
:dependencies [[org.clojure/clojure "1.3.0"]
55
[org.apache.poi/poi "3.6"]
66
[org.apache.poi/poi-ooxml "3.6"]]
7-
:dev-dependencies [[swank-clojure "1.3.0-SNAPSHOT"]
7+
:dev-dependencies [[swank-clojure "1.3.3"]
88
[lein-clojars "0.6.0"]
9-
[lein-difftest "1.3.2-SNAPSHOT"]]
9+
[lein-difftest "1.3.3"]]
1010
:hooks [leiningen.hooks.difftest]
1111
)

test/dk/ative/docjure/spreadsheet_test.clj

+30
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,36 @@
124124
(is (= 42.0 (read-cell number-cell))))))
125125

126126

127+
(deftest set-cell!-test
128+
(let [sheet-name "Sheet 1"
129+
sheet-data [["A1"]]
130+
workbook (create-workbook sheet-name sheet-data)
131+
a1 (-> workbook (.getSheetAt 0) (.getRow 0) (.getCell 0))]
132+
(testing "set-cell! for Date"
133+
(testing "should set value"
134+
(set-cell! a1 (july 1))
135+
(is (= (july 1) (.getDateCellValue a1))))
136+
(testing "should set nil"
137+
(let [^java.util.Date nil-date nil]
138+
(set-cell! a1 nil-date))
139+
(is (= nil (.getDateCellValue a1)))))
140+
(testing "set-cell! for String"
141+
(testing "should set value"
142+
(set-cell! a1 "foo")
143+
(is (= "foo" (.getStringCellValue a1)))))
144+
(testing "set-cell! for boolean"
145+
(testing "should set value"
146+
(set-cell! a1 (boolean true))
147+
(is (.getBooleanCellValue a1))))
148+
(testing "set-cell! for number"
149+
(testing "should set int"
150+
(set-cell! a1 (int 1))
151+
(is (= 1.0 (.getNumericCellValue a1))))
152+
(testing "should set double"
153+
(set-cell! a1 (double 1.2))
154+
(is (= 1.2 (.getNumericCellValue a1)))))))
155+
156+
127157
(deftest sheet-seq-test
128158
(let [sheet-name "Sheet 1"
129159
sheet-data [["foo" "bar"]]]

0 commit comments

Comments
 (0)