please can someone help me ? i have the following code i want to create tables in word but i have the following result. .i will like to have the Table grids thanks
clear all;
word = actxserver('Word.Application');
word.Visible = true;
wdoc = word.Documents.Add;
selection = word.Selection;
word.ActiveDocument.Tables.Add(word.Selection.Range,4,2);
word.Selection.Font.Bold = 1;
word.Selection.TypeText('gender');
word.Selection.MoveRight(12,1,0);
word.Selection.Font.Bold = 1;
word.Selection.TypeText('Name');
word.Selection.MoveRight(12,1,0);
word.Selection.TypeText('Female');
word.Selection.MoveRight(12,1,0);
word.Selection.TypeText('Lucy');
word.Selection.MoveRight(12,1,0);
word.Selection.TypeText('male');
word.Selection.MoveRight(12,1,0);
word.Selection.TypeText('Leo');
word.Selection.MoveRight(12,1,0);
word.Quit();
this is what i get!

 채택된 답변

Mario Malic
Mario Malic 2021년 2월 23일

1 개 추천

Hello,
These two lines add the borders to your table.
tableObj = word.ActiveDocument.Tables.Item(1);
tableObj.Borders.Enable = 1;

댓글 수: 3

lydie Nsangou
lydie Nsangou 2021년 2월 23일
thanks it worked ! Do you please know how to reduce the size of pictures in such a way that two pictures can be inserted in the same page?
Mario Malic
Mario Malic 2021년 2월 23일
Take a look at documentation https://docs.microsoft.com/en-us/office/vba/api/overview/word, left-hand side, expand Object Model under Word, and find the function you use to add the pictures and take a look at methods/properties of it.
lydie Nsangou
lydie Nsangou 2021년 2월 23일
OK thank you for the link

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기

질문:

2021년 2월 23일

댓글:

2021년 2월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by