Ask Your Question
0

Change Character Spacing using Macro [closed]

asked 2017-07-13 14:05:14 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi,

i want to change the character spacing in libre office calc using a macro. The change should affect the whole sheet but i guess i can figure the rest out if someone showed me how to change the caracter spacing for just one cell.

Best regards, Sebastian

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-21 13:27:32.277538

1 Answer

Sort by » oldest newest most voted
0

answered 2017-07-13 15:28:49 +0200

pierre-yves samyn gravatar image

Hi

For the current cell:

sub SetSpacing
dim oCursor as object
oCursor = thiscomponent.currentselection.createTextCursor
oCursor.CharKerning = 60
end sub

Regards

edit flag offensive delete link more

Comments

Thank you very much!

Sadly i fail to use this knowledge to change the kerning for the entire sheet. I was hoping i could do it in the same way i change the font for the entire sheet:

ThisComponent.Sheets(0).CharFontName = ...

but obviously this does not work:

oCursor = ThisComponent.Sheets(0).createTextCursor

How can i change the kerning for the entire sheet? There's got to be a more elegant (and faster) way than do address every single cell in the sheet...

Best regards, Sebastian

Guilty_Spark_343 gravatar imageGuilty_Spark_343 ( 2017-07-14 10:59:20 +0200 )edit

Hi @Guilty_Spark_343

It is a text attribute (not cells). So I'm afraid there's no other way than to go through these.

Regards

pierre-yves samyn gravatar imagepierre-yves samyn ( 2017-07-15 08:17:14 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-13 14:05:14 +0200

Seen: 209 times

Last updated: Jul 13 '17