- 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?
조회 수: 2 (최근 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!