How to go to a sheet by sheetname? - libreoffice

I have around 300-400 sheets in a Libreoffice Calc file.
I have tried everything and I can't seem to go to a particular sheet by its name, that is the sheet is named: XYZ and when I try to find it using XYZ there are no results.
How do I go to a sheet by its name?

Go to Tools -> Macros -> Organize Macros -> LibreOffice Basic and add this code.
Sub gotoSheet
sName = InputBox("Which sheet?")
oSheet = ThisComponent.getSheets().getByName(sName)
ThisComponent.CurrentController.setActiveSheet(oSheet)
End Sub
Then go to Tools -> Customize and attach the macro to a toolbar button or hotkey.
Other options for going to a particular sheet more easily, such as using the Navigator list or creating hyperlinks, are described at:
https://ask.libreoffice.org/en/question/10650/jumping-sheet-tabs/
https://ask.libreoffice.org/en/question/167878/where-is-the-goto-function-within-calc/

No need to create a macro. Just use the keyboard shortcut Ctrl+Shift+F5 to jump to the name box, type the (whole) sheet name and press enter.

Related

Visual studio code - create a macro that copies content over files

I'm looking into creating something like a macro for localization of strings. Until now, I have only find that (maybe) a custom Code Action might be what I need.
After I select some code, let's call it selection, I want the to:
Ask me for a name
Write to another file: name = selection
Write in current file: (some_fixed_code)name(some_other_fixed_code)
Is there any way to create that macro, for it lo launch with a left click option or a keyboard shortcut?
Thanks in advance!

I wish to execute a macro with enter key

I have a macro/Sub that I wish to run everytime the enter key is pressed. Does anyone know the correct syntax?
Excel on Enter Macro
How to run a macro when certain cells change in Excel
Right-click the Sheet1 tab and then click View Code.
The module sheet behind Sheet1 is opened.
Type the following code into the module sheet:
Private Sub Worksheet_Change(ByVal Target As Range) Dim KeyCells As Range. ...
Click Close and Return to Microsoft Excel on the File menu.

How can I get Eclipse to auto-indent code blocks within if and for statements?

I tried to get Eclipse to convert all of the tabs in my project to spaces like this:
Java Editor:
Click Window » Preferences
Expand Java » Code Style
Click Formatter
Click the Edit button
Click the Indentation tab
Under General Settings, set Tab policy to: Spaces only
Click OK ad nauseum to apply the changes.
And now my code is formatted without any indentations within if and for blocks, like this:
private void addAppointment(Resource resource) {
if (resource != null) {
Appt appt1 = new Appt();
appt1.setTime(new Date());
resource.setAppointment(appt1);
}
}
I really don't want to have to manually fix this in the hundreds of files in the project, how can I format to indent within if and for blocks in the whole project?
I should also say that the "Statements within blocks" checkbox in the active Formatter profile is checked. The preview it shows has a for block with an indented body, so I have no idea why that isn't being applied to my project.
#gnac provides some good options, in addition to:
Similarly you can use ctrl+shift+f (Source->Format) on each class to format it on the fly
You can select the project(s) and do Source menu -> Format to format everything in that project in one go. (No keyboard shortcut for it AFAIK.)
So once you set your formatting options you have a couple of options. You can set the preferences to format your files when saving.
Preferences->Java->Editor->Save Actions
However, if you have a lot of files this will be a pain as well. Similarly you can use ctrl+shift+f (Source->Format) on each class to format it on the fly, again having to do it on each file individually.
Inside Eclipse you can use Search->Find, enter "\t" in the text box and select the "Regular Expression" check box and then click the "Replace..." button. When the search is done, it will ask you what to replace it with. Enter 4 spaces into the "With" text field. Click Preview to see what it will do, or OK to make the changes.
I would use a find and sed to find all of the java files in a directory and replace the tabs, although this is outside of eclipse
find -iname ".java" -exec sed -i.orig 's/\t/ /g' {} +
If you're not on Linux you could use cygwin to do the same on Windows.

How to add tab space infront of mutiple lines of code

I am using eclipse IDE for development I have written some code in if-else block and now I want to tab indent every block, Is there any way or command or key sequence so that I can select the lines of code and simply add tab space in front of every line selected.
Use the formatter for this. Right click your file and select Source -> Format. You can also execute this for a single code block. Just select the block and right click -> Source -> Format. You can also format Javadoc this way.
If you don't like the way your code gets formatted you can change the formatter template in Windows -> Preferences -> Java -> Code -> Formatter.
Select the block(or set of statements) and just press TAB to indent. The whole selected block(or set of statements) will be moved.

How to do multiple line editing?

I want to edit multiple lines in eclipse, but I can't find any short cut or Plugin. In Geany I just press ctrl+alt+up/down I can add / edit multiple lines.
Maybe this example can explain what I mean:
var text = "myname";
var addr = "myaddr";
var age = "myage";
I want to edit text above into:
var my_text = "myname";
var my_addr = "myaddr";
var my_age = "myage";
The text above is just a simple example, but sometimes I have many lines of words that I have to edit its prefix.
Press alt + shift + A to Toggle block selection (Toggle block / column selection in the current text editor), this will let you write vertically in eclipse, then you can easily do this.
Go to Window->Preferences.
Find for binding in text box surrounded by red box.
On OS X, the key combination for multi-line edits in Eclipse (or STS) is option/alt+command+A
You can try the following plugin,
https://github.com/caspark/eclipse-multicursor/releases
With this multiple occurrence of same text can be selected and edited. This is similar to multi select functionality available in editors like Sublime and Visual studio code.
The Eclipse 4.24 (June 15 2022) will integrate it (See https://bugs.eclipse.org/bugs/show_bug.cgi?id=576377):
Multi selection down relative to anchor selection (e.g. Ctrl-Alt-J)
Multi selection up relative to anchor selection (e.g. Alt-J)
End multi-selection (e.g. ESC)
Add all matches to multi-selection (e.g. Ctrl-Shift-Alt-J)
Multi caret up (e.g. Ctrl-Alt-Shift-Up)
Multi caret down (e.g. Ctrl-Alt-Shift-Down)
Thanks to eclipse contributor !
The Eclipse 4.22 (Q4 2021) equivalent of Geany would Alt+Click on the lines you want to edit in one go.
Eclipse now supports
Multiple text selection
Support for multiple selection has been added to Text Editors.
Multi selections allow most edit operations (text replacement or insertion, extend selection to next word or to next line, copy/paste...) to apply simultaneously on all ranges.
Multiple strategies are available to enable multi-selections:
Turn a block selection into a multi-selection using the To multi-selection command,
Add a caret with Alt+Click,
Use the new Select All button on the Find/Replace dialog.
So check if this would work in your case.
I know this is an old post, but I still want to share my way of multi select and editing. However this way is restricted to only the same variables across the file. Simply highlight the variable to edit, right click, choose Refactor->Rename. Then edit the variable and it will also edit the same variables across the file. Hope it helps..:)
Press key - { Alt + Shift + A } You will see A [+] symbol in IDE then use this symbol as drag