How can I change the font size of a non-English text in a Word document?

Clc Clear

wordapp=actxserver (’word.application’); wordapp.visible=1; doc=wordapp.Documents.Add; paramod=doc.Paragraphs; paranoid.alignment=1; For i=1:5 para=paramod.Add; paraman=para.Range; paraman.Text=’سلام’; paraman.Font.Size=16*I; paraman.InsertParagraphAfter; end end

Answers (1)

You were very close. There was at least one typo (paranoid vs. paramod). See below
wordapp=actxserver ('word.application');
wordapp.visible=1;
doc=wordapp.Documents.Add;
paramod=doc.Paragraphs;
% paranoid.alignment=1; <<<<< typo?
paramod.alignment=1;
for i=1:5
para=paramod.Add;
paraman=para.Range;
paraman.Text='سلام';
paraman.Font.Size=16*i;
paraman.InsertParagraphAfter;
end
% Close the document window
invoke(doc, 'Close');
% Quit MS Word
invoke(wordapp, 'Quit');
% Terminate ActiveX connection
delete(wordapp);
Result:

1 Comment

Dear Beckham; Thank you, it was my fault while writing, but what is important is that I can’t change the font size of non-English text in a Word document.

Sign in to comment.

Categories

Asked:

on 11 Mar 2025

Commented:

on 15 Mar 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!