Open rPetas opened 3 years ago
I will need some usage questions answered.
Specifically: the goal of rubyXL
is not to give you an Excel experience. The goal is to give you access to the data, so you can make your own experience in whatever way you deem suitable.
From that standpoint, cell.formula
gives you access to formula
tag of the XML encoding that cell, not "gives you formula that Excel shows in that cell".
It is possible to make an convenience method that will give you "formula that Excel shows in that cell". However, you will have to answer at least a few questions for that situation.
formula
is already taken.t="shared" si="..."
) in it, then what should we do when a new formula is attempted to be written into it? a) Remove the original group formula from the cell and insert a new "singular" formula, or b) replace the formula value in that cell, which means the formula will magically change in the entire group?ref
value may need to move to a different cell (that still remains a part of the formula group) as well.$
are relative to the current cell. So assume you have a group formula that is located in the cell A1 and says "=B2". Which, given that it's relative to A1, means "={+1,+1}". Then if cell F23 is also in that group, in the cell A1 that formula will mean "=B2", and in the cell "F23", it will mean "=G24" -- while formula expression that the accessor returns remains exactly the same. So if you are using that special accessor we are planning to write, given that the formula parser hasn't been written yet, such conversion can't be done in rubyXL
and then people will complain that "formula that they get using that accessor is is not what Excel gives them". Are you prepared for that?In short, like with just about everything else, the idea looks great on the surface -- but as soon as you start actually digging deeper, the number of things that need to be done, balloons rapidly.
The following file is a simple table with many formulas in the same row(basically a sum of each column in the table) When the file is edited it automatically changes these formula to a "shared" type of formula to optimize space usage.
Currently when trying to read the formula on these cells with the "shared" type, the expression comes as an empty string, probably because the expression the in inline text in the tag is being read (and it does not exist), but in this case it should be somehow calculated from its reference (si).
This was detected because I am trying to read the formulas to update them after inserting some lines on the table.
To circumvent the problem ill try in my code to process how the formula should be by myself. I just though it should be known. I could try to help if you point me in the right direction. example.xlsx