Ask Your Question

Change Character Spacing using Macro

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.


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 close merge delete

1 Answer

Sort by » oldest newest most voted

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

pierre-yves samyn gravatar image


For the current cell:

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


edit flag offensive delete link more


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.


pierre-yves samyn gravatar imagepierre-yves samyn ( 2017-07-15 08:17:14 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 193 times

Last updated: Jul 13 '17