Skip to content

Commit 038f56e

Browse files
committed
Update POI writer to handle consecutive wide cells (address #3)
1 parent 8a8482c commit 038f56e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/excel_clj/poi.clj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@
121121
poi-cell (.createCell poi-row cidx)]
122122

123123
(when (or (> width 1) (> height 1))
124+
;; If the width is > 1, move the cursor along so that the next write on
125+
;; this row happens in the next free cell, skipping the merged area
126+
(vswap! col-cursor + (dec width))
124127
(let [ridx @row-cursor
125128
cra (CellRangeAddress.
126129
ridx (dec (+ ridx height))
@@ -213,7 +216,14 @@
213216
;; This one won't be visible, because it's hidden behind the tall cell
214217
(write! t "1")
215218
(write! t "2")
216-
(write! t "3"))))
219+
(write! t "3")
220+
221+
(newline! t)
222+
(write! t "Wide" nil 2 1)
223+
(write! t "Wider" nil 3 1)
224+
(write! t "Much Wider" nil 5 1)))
225+
226+
)
217227

218228

219229
(defn performance-test

0 commit comments

Comments
 (0)