Ask Your Question
0

Creating a keyboard shortcut for a specific font

asked 2019-06-11 20:22:26 +0200

Erel Segal-Halevi gravatar image

In Impress, I would like to make "Ctrl+T" convert the currently selected text to "Times New Roman" font.

In Tools->Customize, I found only the option of "Font Name". But when I set Ctrl+T to "Font Name" and click Ctrl+T, I just get the "Font Name" dialogue where I have to manually pick this font each time.

Is there a way to create a shortcut that will automatically change the font to Times New Roman without a dialogue?

edit retag flag offensive close merge delete

Comments

As it looks, there is no way with the keys. The question is, what do you want to achieve? Do you want to work fast with changing fonts, or do you just want to set a different font? For the latter, the format templates offer. Please edit your question and write what you want to achieve.

ebot gravatar imageebot ( 2019-06-11 20:52:32 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-06-11 20:53:07 +0200

Insert the macro

sub TNR
dim document, dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(4) as new com.sun.star.beans.PropertyValue
args1(0).Name = "CharFontName.StyleName"
args1(0).Value = ""
args1(1).Name = "CharFontName.Pitch"
args1(1).Value = 2
args1(2).Name = "CharFontName.CharSet"
args1(2).Value = 0
args1(3).Name = "CharFontName.Family"
args1(3).Value = 3
args1(4).Name = "CharFontName.FamilyName"
args1(4).Value = "Times New Roman"
dispatcher.executeDispatch(document, ".uno:CharFontName", "", 0, args1())
end Sub

in:

image description

See sequencing in the images:

image description

image description


ATTENTION: If you would like to give more details to your question, use edit in question or add a comment below. Thank you.

If the answer met your need, please click on the ball Descrição da imagem to the left of the answer, to finish the question.

edit flag offensive delete link more

Comments

This worked. Thank you so much!

Erel Segal-Halevi gravatar imageErel Segal-Halevi ( 2019-06-12 06:54:03 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-06-11 20:22:26 +0200

Seen: 32 times

Last updated: Jun 11