- 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?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Jack
2025-3-12
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!