Put TAB in a cell

Discuss the spreadsheet application
Post Reply
carlmclark
Posts: 1
Joined: Sun Mar 22, 2020 3:36 pm

Put TAB in a cell

Post by carlmclark »

Is there a way to disable the interpretation of the TAB key and let it pass through literally during cell data input?
Last edited by MrProgrammer on Sat Apr 04, 2020 4:34 pm, edited 1 time in total.
Reason: Changed subject, was: Keyboard Input Driver
OpenOffice version 4.1.3, Windows 10 Home Edition, Version 1903
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Put TAB in a cell

Post by JohnSUN-Pensioner »

Why not?
You can, for example, paste a tab character in a blank document in Notepad, copy it to the clipboard, and as you type text into the cell, press Ctrl+V in the right places.
Or you can enter text in a cell as a formula of the form

Code: Select all

="Two Beers"&CHAR(9)&"Or"&CHAR(9)&"Not Two Beers?"
where CHAR(9) is the tab character
This is not an exhaustive list of features, but I'm just wondering - why do you need such an opportunity?
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Put TAB in a cell

Post by Zizi64 »

Here is a macro solution. Just copy/paste the macro code into MyMacros/Standard library/Module1 and then assign it the macro "cell_TAB" to a free hotkey like the Ctrl-T (or other).
The macro will insert a TAB character into the cursor position.

Code: Select all

sub cell_TAB
insert_a_char(CHR(9))
end sub


'*************************************************************************

sub insert_a_char(SpecChar as string)
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
'dim args1(0) as new com.sun.star.beans.PropertyValue
'args1(0).Name = "Text"
'args1(0).Value = SpecChar
'dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Symbols"
args2(0).Value = SpecChar

dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args2())
end sub
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.
Post Reply