creating Tables in word using actxserver

14 Ansichten (letzte 30 Tage)
lydie Nsangou
lydie Nsangou am 23 Feb. 2021
Kommentiert: lydie Nsangou am 23 Feb. 2021
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!

Akzeptierte Antwort

Mario Malic
Mario Malic am 23 Feb. 2021
Hello,
These two lines add the borders to your table.
tableObj = word.ActiveDocument.Tables.Item(1);
tableObj.Borders.Enable = 1;
  3 Kommentare
Mario Malic
Mario Malic am 23 Feb. 2021
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 am 23 Feb. 2021
OK thank you for the link

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Use COM Objects in MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by