필터 지우기
필터 지우기

Centring a table into a Word Doc.( Activex)

조회 수: 14 (최근 30일)
Belen
Belen 2014년 10월 8일
댓글: Frederic Tschanz 2016년 1월 11일
Hi.
I'm using matlab to create a report which includes several figures, texts and tables. The point is, when I copy a table it is automatically aligned to the left, although the paragraph format is "center". I've tried to select the table and to align again the paragraph using this:
ActXWord.Selection.ParagraphFormat.Alignment = 'wdAlignParagraphCenter';
But it doesn't work (it centers the content of the table, not the table). could anyone help me? Thanks in advance :D
  댓글 수: 3
Belen
Belen 2014년 10월 27일
Thank you Lain, but it doesn't work. this is the error I get:
ActXWord.Selection.Alignment = 'wdCenter'; ??? No public field Alignment exists for class Interface.Microsoft_Word_11.0_Object_Library.Selection.
Is there any way to add the needed library ? anyone knows which is it?
Frederic Tschanz
Frederic Tschanz 2016년 1월 11일
Try this:
table = document.Tables.Add(selection.Range,numRows,numCols); % insert a table
table.Rows.Alignment = 'wdAlignRowCenter'; % center the table

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

답변 (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