mjul / docjure

Read and write Office documents from Clojure
MIT License
622 stars 129 forks source link

Data format now being applied? #69

Closed rafaelrinaldi closed 6 years ago

rafaelrinaldi commented 6 years ago

I'm having an issue where no matter if I specify :data-format it doesn't seem to get applied to the Excel file.

(let [workbook (excel/create-workbook "test" [[91596]])
      sheet (excel/select-sheet "test" workbook)
      cells (excel/cell-seq sheet)
      cell (nth cells 0)
      style (excel/create-cell-style! workbook {:data-format "#,##0"})]
    (excel/set-cell-style! cell style)
    (println cell) ;; #object[org.apache.poi.xssf.usermodel.XSSFCell 0x7594019e 91596.0]
    (println (-> style (.getDataFormatString))) ;; General
    (println (-> style (.getDataFormat))) ;; 0
    (excel/save-workbook! "testing.xlsx" workbook))

As you can see from the logs, it doesn't seem to be being passed down at all.

Expected Actual
91,596 91596

What am I doing wrong?

mjul commented 6 years ago

You are creating a cell with value 91596. Formatting applies to how it is displayed when you open the spreadsheet file in Excel, where it is displayed as expected with a thousand separator.