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

11 views (last 30 days)

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)

Les Beckham
Les Beckham on 11 Mar 2025
Edited: Les Beckham on 11 Mar 2025
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
Majid kh
Majid kh on 15 Mar 2025

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

Find more on MATLAB Report Generator in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!