Comments (1)
I ran into the same problem. I solved it for my quite humble needs by extending the string cell processing:
(ns ...
(require [dk.ative.docjure.spreadsheet :as docjure]))
(defmethod docjure/set-cell! String [^Cell cell val]
(let [is-formula-cell? (= (.getCellType cell) CellType/FORMULA)
is-formula-val? (clojure.string/starts-with? val "=")]
(if is-formula-val?
(.setCellFormula cell ^String (clojure.string/replace val #"^=" ""))
(do (when is-formula-cell? (.setCellType cell CellType/STRING))
(.setCellValue cell ^String val)))))
Here we use a leading =
sign in the string cell value to guess user wants to insert a formula. If we don't remove the leading =
, Cell.setCellFormula
will throw an exception. This emulates what happens when you type a formula with a leading =
into a spreadsheet.
If anyone is interested, I'm willing to create a PR and some test.
Notice that Apache POI does not support all formulae, so YMMV.
from docjure.
Related Issues (20)
- Generate documentation (on push)
- Add documentation build and badge HOT 3
- Expose quotePrefixed style attribute in `create-cell-style!` HOT 2
- Reuse similar-looking CellStyles HOT 1
- New release needed to support auto-size-all-columns! documented in README.md HOT 1
- Make `dk.ative.docjure.spreadsheet/create-date-format` public
- Simplest way to place data HOT 2
- ODS file support HOT 4
- The maximum number of Cell Styles was exceeded. You can define up to 64000 HOT 3
- Error upgrading to 0.13 using java 1.8 HOT 3
- Automatically use header row to read tabular sheet HOT 1
- CVE-2019-12415 HOT 9
- Numeric text string being read as float HOT 7
- Get index with select-columns HOT 1
- Writing on an empty cell HOT 2
- SKEW formula in Excel results in exception instead of :FUNCTION_NOT_IMPLEMENTED HOT 2
- Applying styles to multiple sheets? HOT 1
- Create save to stream example in documentation
- CVE-2022-26336: org.apache.poi/poi "4.1.1" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docjure.