4

I copy and then paste values in excel quite a bit (when I use Excel). When I use LibreOffice you can do the same thing (see related question here) but it is oh so tedious!

It gets especially tedious as I occasionally use the other options under paste special. Since this paste special values dialogue box remembers your last settings, to get the right past special I have to look at its current settings and check and uncheck until I get what I want. Since I frequently past just values I would much rather have a set of keystrokes my fingers could memorize and I could repeat each time I want to do this.

How can I get a set of keystrokes that will consistently paste just the text and the numbers in libre office? Since I want to be able to do this quickly I prefer fewer keystrokes to more.

1
  • This sounds like a job for a macro, so perhaps another question in that direction on StackOverflow will give you a solution.
    – mpy
    May 9 '13 at 17:24
6
+25

(I'll keep this answer here because it is more general than using a builtin command as suggested in my other answer — with a macro you can use any combination of paste options, not just a couple of predefined operations.)

You can define a macro and bind it to a key combination. The simplest way is probably to use the macro recorder:

  1. Ensure that macro recording is turned on: Choose Tools → Options, choose the LibreOffice → General page, then check the “Enable macro recording” option.

  2. Prepare to record the macro: Copy a cell to clipboard (options offered for the Paste Special… command depend on clipboard contents, so you need to have something coming from LibreOffice Calc in the clipboard if you want to record a macro for pasting data copied from Calc).

  3. Select an empty cell to which you will paste the copied data.

  4. Start macro recording: Choose Tools → Macros → Record Macro. The ”Record Macro” toolbar with a Stop Recording button will appear.

  5. Select Edit → Paste Special…, then choose the combination of options you want to record in the macro and press OK.

  6. Click the Stop Recording button; a dialog for saving the macro will appear. Enter the new macro name (e.g., PasteAsTextOrNumber), select My Macros/Standard/Module1 in the left tree, then press the Save button. (If you enter a macro name which already exists in the module, you will need to confirm that you want to overwrite the old macro; there is no way to append new action to an existing macro using just the macro recorder.)

  7. Now you can assign the macro to a shortcut key. Select Tools → Customize, then switch to the “Keyboard” tab, select the desired shortcut key combination in the top list, then find the macro in bottom lists:

    • Category: LibreOffice Macros → user → Standard → Module1
    • Function: your macro name (e.g., PasteAsTextOrNumber)

    Press Modify to assign the macro to the key combination.

    You can also create a toolbar button for the macro using the “Toolbars” tab.

The macro code generated for me when only “Text” and “Numbers” options were checked is:

sub PasteAsTextOrNumber
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(5) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Flags"
args1(0).Value = "SV"
args1(1).Name = "FormulaCommand"
args1(1).Value = 0
args1(2).Name = "SkipEmptyCells"
args1(2).Value = false
args1(3).Name = "Transpose"
args1(3).Value = false
args1(4).Name = "AsLink"
args1(4).Value = false
args1(5).Name = "MoveMode"
args1(5).Value = 4

dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args1())


end sub
1
  • It is the advanced answer.
    – kokbira
    Jul 4 '18 at 11:56
5

After looking more closely at the “Customize” dialog, I found commands which probably do what you want without using macros:

  1. Select Tools → Customize, then switch to the “Keyboard” tab.

  2. Select the desired key combination in the “Shortcut Keys” list.

  3. Select “Edit” in the “Category” list, then select .uno:PasteOnlyValue in the “Function” list. (According to this bug report, since LibreOffice 4.0.0 this item should be labeled as “Paste Only Value”, possibly translated to your language; I'm still using 3.6 here.)

    There are also several other related commands in the “Edit” category:

    • .uno:PasteOnly (Paste Only)
    • .uno:PasteOnlyFormula (Paste Only Formula)
    • .uno:PasteOnlyText (Paste Only Text)
  4. Press the Modify button to assign the function to the key combination.

1
  • Yes, in 4.0.x the edit commands are correctly labelled as "Paste only Value" etc. May 15 '13 at 11:13
4

I have been playing around with the Paste Special menu that gets brought up by pressing CTRL+SHIFT+v. I noticed that some keys toggle options. I can't seem to find any documentation though. Here are the hot keys docs for libra office calc General Shortcut Keys in LibreOffice I can't find anything through searching the site either.

So I guess I'll just go through and see what they do.

a = Selects "Add" radio button.

b = N/A
c = Toggles selection of "OK" and "Cancel".
d = Toggles "Date & time" check box.
e = Selects "None" radio button.
f = Toggles "Formulas" check box.
g = N/A
h = Opens help menu.
i = Selects "Don't shift" radio button.
j = N/A
k = Toggles "Skip empty cells" check box.
l = Toggles "Link" check box.
m = Toggles "Formats" check box.
n = Toggles "Numbers" check box.
o = Selects "Objects" but does not toggle?
p = Toggles "paste all" check box.
q = N/A.
r = Selects "Right" radio button.
s = Selects "Subtract" radio button.
t = Toggles "Transpose" check box.
u = N/A
v = Selects "Divide" radio button.
w = Selects "Down" radio button.
x = Toggles "Text" check box.
y = Selects "Multiply" radio button.
z = N/A

Nothing with punctuation or numbers. Shift+Letter seem to have same effect as lowercase letter.

1
  • Thanks for your response. It provides additional information and speeds things up vs using the mouse. I don't believe any memorized set of these key combinations will give me what I'm looking for. Correct me if you think this does. thanks.
    – snowguy
    May 9 '13 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.