I would have used a text cursor, but, the recorded Macro is trivially modified 
to remove the font name, you just need to know that you can do that :-)

sub insertAlphaNoFont
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 = "Symbols"
args1(0).Value = "α"

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

end Sub

Lot easier than another solution (if you really did need the font name), which 
would look at the text cursor and pull the current font and use that. Inserting 
text at a text cursor (view cursor) should also not have needed a font. 

On Wednesday, February 13, 2019 00:51 EST, Thomas Blasejewicz <ny...@hb.tp1.jp> 
wrote:
 On 2019/02/13 13:26, Andrew Pitonyak wrote:
> if I wrote a macro that inserts the letter 'X', I would not expect the
> insertion to specify the font unless I went out of my way to do so.
>
> I am interested in seeing the macro that you are using.

Well, I am not actually "writing" the macro - I have no idea how to do
that.
I use "Tools -> Macros -> Record macro" and open the "insert special
characters dialog box".
THIS is where the problem is.
As far as I can tell, there is no way NOT to select a font in that dialog.
On top you have the "Search / Font / Subset" fields.
"Font" gives you a list of fonts, but not the choice of "none /
automatic" etc. - or allows you to delete the currently selected font.
I had been hoping to find that kind of choice.

Mr. Pitonyak. Please don't worry. I am not in a hurry. I have been
pondering this for years already ...

Thank you.
Thomas Blasejewicz







>
>
>
> Sent from BlueMail <http://www.bluemail.me/r?b=14470>
> On Feb 12, 2019, at 9:55 PM, Thomas Blasejewicz <ny...@hb.tp1.jp
> <mailto:ny...@hb.tp1.jp>> wrote:
>
> Good morning
> I have another strange question.
> Work related I have to insert not infrequently symbols into texts.
> To make work easier, I have already created a number of macros to insert
> for example the symbol "micro" into a text using a keyboard shortcut.
>
> Problem:
> Let's say, I created the macro in a document that happened to use
> "Arial" as font and later want to use it in a document that uses "Times
> Roman". The macro I created then inserts an "Arial font micro" into the
> Times Roman text, which then looks out of place.
>
> Is there a trick to create macros, so that the inserted symbol matches
> the surrounding font?
> I have tried all sorts of things, but could not yet find a solution.
> It is not really a "problem", but such an automatic font adjustment
> would be nice/helpful.
>
> Thank you.
> Thomas
>


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


 

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Reply via email to