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

Creating a macro - Writing a Script - Using the API

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

Postby eeigor » Fri Dec 25, 2020 7:11 am

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.1.3.2 Community
eeigor
 
Posts: 132
Joined: Sun Apr 12, 2020 10:56 pm

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

Postby Zizi64 » Fri Dec 25, 2020 9:03 am

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; LO6.1.6, 6.4.7 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.1.1;AOO4.1.9
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.
User avatar
Zizi64
Volunteer
 
Posts: 9838
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby eeigor » Fri Dec 25, 2020 9:45 am

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.1.3.2 Community
eeigor
 
Posts: 132
Joined: Sun Apr 12, 2020 10:56 pm

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

Postby Zizi64 » Fri Dec 25, 2020 9:54 am

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; LO6.1.6, 6.4.7 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.1.1;AOO4.1.9
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.
User avatar
Zizi64
Volunteer
 
Posts: 9838
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby eeigor » Fri Dec 25, 2020 10:07 am

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.1.3.2 Community
eeigor
 
Posts: 132
Joined: Sun Apr 12, 2020 10:56 pm

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

Postby Zizi64 » Fri Dec 25, 2020 10:50 am

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; LO6.1.6, 6.4.7 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.1.1;AOO4.1.9
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.
User avatar
Zizi64
Volunteer
 
Posts: 9838
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby eeigor » Fri Dec 25, 2020 1:49 pm

The question is removed, I was wrong.
Ubuntu 18.04 LTS • LibreOffice 7.1.3.2 Community
eeigor
 
Posts: 132
Joined: Sun Apr 12, 2020 10:56 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests