- doc.Paragraphs.Add creates a new paragraph and returns a Paragraph object.
- You can then set Alignment, Text, and Font.Size on para.Range.
- This works the same way for non-English text or numeric strings.
How do I change the size of font of a non-english text or numbers in a word document?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
clc
clear
wordApp = actxserver('Word.Application');
wordApp.Visible =true;
doc = wordApp.Documents.Add();
doc.Paragraphs.alignment=1;
for i=1:3
para=doc.Paragraphs.Add;
doc.Paragraphs.Add.Range.Text='سلام';
doc.Paragraphs.Add.Range.Font.Size=16*i;
doc.Paragraphs.Add.Range.InsertParagraphAfter;
end
0 Kommentare
Antworten (1)
Jack
am 12 Mär. 2025
Here’s a concise example of how to insert non-English text (Arabic) into Word and set its font size using MATLAB’s ActiveX interface:
clc
clear
wordApp = actxserver('Word.Application');
wordApp.Visible = true;
% Create a new document
doc = wordApp.Documents.Add;
% Insert three paragraphs of Arabic text at different font sizes
for i = 1:3
para = doc.Paragraphs.Add; % Create a new paragraph
para.Alignment = 1; % Center alignment (optional)
para.Range.Text = 'سلام'; % Non-English text
para.Range.Font.Size = 16*i; % Change font size
end
Follow me so you can message me anytime with future questions. If this helps, please accept the answer and upvote it as well.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!