Ask Your Question
0

LibreOffice macro to replace unicode text bold

asked 2018-12-02 02:21:55 +0100

Aniruddha Mohod gravatar image

updated 2018-12-18 14:02:13 +0100

gabix gravatar image

I have created a macro for all Exh. Bold but the macro for creating Unicode text bold is not working

Here is the macro for Exh. Bold

REM  *****  BASIC  *****

Sub ExhBold
RDescrip = ThisComponent.createReplaceDescriptor
RDescrip.searchRegularExpression = True
RDescrip.searchString = "Exh. [:digit:]{1,4}"
rngs = ThisComponent.findAll(RDescrip)
for i = 0 to rngs.count-1
   foundText = rngs.getByIndex(i)
    foundText.CharFontName = "Bitstream Charter"
    foundText.CharHeight = 14
   foundText.CharWeight = 150
next i
End Sub
It makes bold words like Exh. 1, Exh. 21, Exh. 235 etc.

But when I just replace the code it is not giving me the expected result.

Sub NishaniBold
RDescrip = ThisComponent.createReplaceDescriptor
RDescrip.searchRegularExpression = True
RDescrip.searchString = "नि. क्र. [:digit:]{1,4}"
rngs = ThisComponent.findAll(RDescrip)
for i = 0 to rngs.count-1
   foundText = rngs.getByIndex(i)
    foundText.CharFontName = "Lohit Marathi"
    foundText.CharHeight = 14
   foundText.CharWeight = 150
next i

End Sub

It is not making bold the following words नि. क्र. १, नि. क्र. २१, नि. क्र. २३५ I can do this by find and replace but I want a macro for it. Please help.

edit retag flag offensive close merge delete

Comments

I have edited your question. For future, use the pre-formatted code option when posting a program code sample, otherwise it is not readable.

gabix gravatar imagegabix ( 2018-12-18 14:00:42 +0100 )edit

Try also setting "CharFontNameComplex", "CharHeightComplex", "CharWeightComplex", and/or "CharFontNameAsian", "CharHeightAsian", "CharWeightAsian".

Mike Kaganski gravatar imageMike Kaganski ( 2018-12-18 14:55:34 +0100 )edit

Thanks a lot

Aniruddha Mohod gravatar imageAniruddha Mohod ( 2018-12-18 16:55:19 +0100 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2018-12-19 07:26:26 +0100

Aniruddha Mohod gravatar image

updated 2018-12-20 10:35:04 +0100

My problem is solved by the comment of Mike Kaganski. Here is the macro that worked. Thanks a lot ask.libreoffice for a quick reply.

RDescrip = ThisComponent.createReplaceDescriptor
RDescrip.searchRegularExpression = True
RDescrip.searchString = "नि. क्र. [:digit:]{1,4}"
rngs = ThisComponent.findAll(RDescrip)
for i = 0 to rngs.count-1
   foundText = rngs.getByIndex(i)
    foundText.CharFontNameComplex = "Lohit Marathi"
    foundText.CharHeightComplex = 12
   foundText.CharWeightComplex = 150
next i
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-12-02 02:21:55 +0100

Seen: 125 times

Last updated: Dec 20 '18