Is it possible to place the content of a cell inside a formula. By formula I mean the math formula editor (insert->object->formula).
标签:
openoffice-calc
相关问题
- Row numbering selection auto-fill till the end [cl
- Applying a formula to all cells in a column, not j
- CSV writing strings of text that need a unique del
- How can I call a Python macro in a cell formula in
- Python, OpenOffice: Programmatically Manipulating
相关文章
- CSV writing strings of text that need a unique del
- How can I call a Python macro in a cell formula in
- Python, OpenOffice: Programmatically Manipulating
- 你如何复制数组公式向下Calc的列?(How do you copy an array formul
- OpenOffice的Calc的宏观添加饼图(OpenOffice Calc macro to ad
- 这需要一个唯一的分隔符的文本CSV文字串(CSV writing strings of text t
- OpenOffice Error vnd.sun.star.GraphicObject
- Using a script to automate data entry to an OpenOf
To the best of my knowledge, there is no way to reference a cell from a formula. Math formula editor has no knowledge about OO Calc. However, you can create a new formula whenever needed using macros.
Follow thesse steps to make it work:
Put the math formula you want to insert to a cell. For example, put some numbers to cells A1, A2, A3 and put the following to cell C3:
This will generate something like
{1} over {2 `+` 3} `=
in C3Create a macro from the code below. In OO Calc, select
Create a new macro and paste the code below.
Now you can run macro using
Tools > Macros > Run Macro
. Run eitherinsertFormula
which inserts math formula generated from cell C3, oraddFormulaListener
which will register a listener and regenerate the formula for you whenever contents of C3 changes.Here is the code. It contains constants
formulaCellFrom
andformulaCellTo
, which specify which cell has the math formula source and which is the target cell where the generated formula object shall be placed. Note that the target cell must be large enough for the generated formula, otherwise the macro won't delete cell's old content when regenerating the formula.The code was adapted from this question. Apparently, the macro must be created in
My Macros
and doesn't work when embedded in the spreadsheet (security measure? it just didn't work for me). The source and target cells are hardcoded but you can modify the macro to suit your needs. I'm not skilled in Visual Basic but such modifications should be easy.