1
votes

In a Word 2007 document, I manually select a sentence containing both English & Bengali words of multiple font size. When I enter some numeric value in Font size list-box in the panel and press Enter, the whole sentence font size is changed (including Bengali words).

When I select the same sentence in a Word-VBA macro and in final line try

Selection.font.Size=8

only English words' font size gets changed.

  • I tried to loop through each character, but got the same result.
  • I need to stick to Word-VBA as it is part of a web scraping program using Chrome web-driver Selenium.
  • I tried a simple macro in a manually created Word document with manually typed mixed English and Bengali words with Vrinda (Body CS) font and the result was the same. Whole sentence selected but only English words' fonts get changed.

Sample Text "I am Ok You are Ok আমিও ঠিক তুমিও ঠিক Is it ok"

1
Thanks for adding the sample text - that helped!Cindy Meister

1 Answers

2
votes

Word differentiates between text formatted as left-to-right (LTR) and text formatted as right-to-left (RTL). I'm not familiar with written (or spoken) Bengali, but Word apparently considers it to be RTL. In the object model (VBA) there's a separate set of Font properties for RTL - the suffix Bi is added to the property name. So

Selection.Font.Size = 8
Selection.Font.SizeBi = 8

Should take care of both languages.