[Solved] How to get a cell value in the edit mode in Calc

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
eeigor
Posts: 214
Joined: Sun Apr 12, 2020 10:56 pm

[Solved] How to get a cell value in the edit mode in Calc

Post by eeigor »

How can I get a new active cell value that hasn't been saved yet?
The user entered a value in the edit mode, but did not exit the cell.

If I'm not mistaken, in Excel this cell property is called "Text" (ActiveCell.Text).
Last edited by eeigor on Fri Dec 25, 2020 1:50 pm, edited 1 time in total.
Ubuntu 18.04 LTS • LibreOffice 7.5.3.2 Community
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to get a cell value in the edit mode in Calc

Post by Zizi64 »

The user entered a value in the edit mode, but did not exit the cell.
And what about the hitting Enter key?

If the entered value has not been accepted, then the value is not assigned to the active cell. It is stored only in a temporary buffer somewhere... (I do not know how, and where from you can get it)

When the value has been accepted by the Enter key or by leaving the cell, then you will able get the (textual or numeric) value FROM the cell.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
eeigor
Posts: 214
Joined: Sun Apr 12, 2020 10:56 pm

Re: How to get a cell value in the edit mode in Calc

Post by eeigor »

Alas, no. It is necessary to take the value from the buffer, if there is no corresponding property.
In any case, thank you for your feedback.
But maybe @Villeroy will respond and offer a solution?
Ubuntu 18.04 LTS • LibreOffice 7.5.3.2 Community
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to get a cell value in the edit mode in Calc

Post by Zizi64 »

Have you tried to use the InputBox in your macro? By usage of the InputBox you can get the entered value BEFORE you assign it to a cell.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
eeigor
Posts: 214
Joined: Sun Apr 12, 2020 10:56 pm

Re: How to get a cell value in the edit mode in Calc

Post by eeigor »

Yes, that's what I just wrote about.
"I need to extend the entered value to other cells. But if the solution is cumbersome, then it is probably better to run the procedure before entering and accept the value via the InputBox() function."

But let's wait a bit…

UPD:
However, the value is a formula, and it would be better to write it in the formula bar…
Ubuntu 18.04 LTS • LibreOffice 7.5.3.2 Community
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to get a cell value in the edit mode in Calc

Post by Zizi64 »

However, the value is a formula, and it would be better to write it in the formula bar…
You can set the
- Value (numeric)
- Text (string)
- Formula (English like)
- Formulalocal (localized formula)
of a cell by your macro code.

Here are some samples from Villeroy - of course - :
viewtopic.php?f=75&t=76258
viewtopic.php?f=20&t=17428
Last edited by Zizi64 on Fri Dec 25, 2020 2:24 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
eeigor
Posts: 214
Joined: Sun Apr 12, 2020 10:56 pm

Re: How to get a cell value in the edit mode in Calc

Post by eeigor »

The question is removed, I was wrong.
Ubuntu 18.04 LTS • LibreOffice 7.5.3.2 Community
Post Reply