I want to change the font and set its style to bold. I have two problems:
- changing
CharWeightworks but notCharFontName - it applies "bold" to the whole paragraph, not only to the selection
Here's my code:
sub AddAnimation
xTextCursor = ThisComponent.CurrentController.Selection(0)
xText = xTextCursor.getText()
xText.CharFontName = "Consolas"
xText.CharWeight = com.sun.star.awt.FontWeight.BOLD
end Sub
Calling
getText()gets the entire text, not just the selected part.The font name changed when I tried it, using both LO and AOO.
Are you using CTL or CJK scripts? If so, then it needs to be
CharFontNameComplexorCharFontNameAsian. However ifCharWeightworked, then that must not be the issue.One more guess: Maybe a style is overriding it.