> -----Original Message-----
> From: Peter Kovacs [mailto:[email protected]]
> Sent: Wednesday, April 28, 2021 4:28 AM
> To: [email protected]
> Subject: Feature: automatic enter of a decimal point at a
> fixed position
>
> Hello all,
>
>
> I have been asked on Facebook, and I found a forum thread if
> there is a
> feature that interprets the entry of numbers the last 2
> numbers as digits.
>
> So if you enter 1234 calc will enter 12.34 in the cell. This
> is good for
> accountants to enter a lot of numbers. (Need to think less, which I
> appreciate when I have to do a lot repeated tasks.)
>
> Excel does this with some complicated menu.
>
> I could not find any feature or extension. Adding this as a extension
> sounds great to me and this sounds not to complicated.
>
>
> I would go for
>
> # a extension config which sets up the digits to be moved.
>
> # a button to toggle the feature
>
> # a small macro that divides by the setup amounts if the cell is
> overwritten. (don't know if this definition can be used)
>
>
> Any Ideas, or inputs? Does LO maybe have done this? (I could not find
> any hints.)
>
> How we could take care the extension gets translated? (we =
> community, I
> do not think this needs to be an ASF extension.)
This is simple. You need the following working macro (the macro still needs
some error routines):
Sub Main
addr = Thiscomponent.getCurrentSelection
If addr.supportsService("com.sun.star.sheet.SheetCell") Then
Thiscomponent.getCurrentSelection.Value =
Thiscomponent.getCurrentSelection.Value/100
End If
End Sub
and these two macros to activate and deactivate the function:
Sub activate_special_input()
Dim mEventProps(1) as new com.sun.star.beans.PropertyValue
mEventProps(0).Name = "EventType"
mEventProps(0).Value = "Script"
mEventProps(1).Name = "Script"
mEventProps(1).Value =
"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
ThisComponent.CurrentController.ActiveSheet.Events.ReplaceByName("OnChange",
mEventProps())
End Sub
Sub deactivate_special_input()
ThisComponent.CurrentController.ActiveSheet.Events.ReplaceByName("OnChange",
Array())
End Sub
I have uploaded a draft here:
www.calc-info.de/files/SpecialInput.ods
Please note the menu "Special Input" included in the file.
greetings,
Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]