Using activex control for word - no spacing between paragraphs

조회 수: 4 (최근 30일)
James Boyle
James Boyle 2017년 7월 19일
댓글: James Boyle 2017년 7월 25일
Word seems to default to paragraphs taking up two spaces. I wan it to make a MATLAB code that will generate a report, but when I use the command selection.TypeParagraph it does a double space, as is the default. I cannot seem to find a way of changing this so that there is no spacing. I'm new to activex. The basic idea of the code is below. Any help much appreciated! (Using 2016a, windows) I want it to output
Text here:
Second line of text:
But currently it is outputting as...
Text here:
.
Second line of text:
word = actxserver('Word.Application'); word.Visible = 1; document = word.Documents.Add; selection=word.Selection;
selection.TypeText('Text here:'); selection.TypeParagraph selection.TypeText('Second line of text:');

채택된 답변

Sangeetha Jayaprakash
Sangeetha Jayaprakash 2017년 7월 25일
Try changing the spacing between paragraphs by changing the "LineUnitAfter" property as follows:
selection.Paragraphs.LineUnitAfter = 0.01
  댓글 수: 1
James Boyle
James Boyle 2017년 7월 25일
Thanks for the answer. I did already try this actually and it is a useful feature, but it doesn't reduce the spacing completely. However, if I set it so that the default is no line spacing, I can then use this if I require larger spacing, so I think it ultimately does solve my problem.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by