Change of the width of the Column of tables in PowerPoint from MATLAB using ActiveX

3 views (last 30 days)
Using ActiveX, I added a table to PowerPoint.
Please tell me the method to change the width of the column that I appointed.
Here is the code I have so far:
PowerPoint = actxserver('PowerPoint.Application');
PowerPoint.Visible = 1;
Presentation = PowerPoint.Presentations.Open( fullfile(pwd,'PPT_Template.pptx')) ; % open File
No=7; % Add LayoutNo
t_NewLayout = Presentation.SlideMaster.CustomLayouts.Item(No);
i_Page = 1;
t_Slide = Presentation.Slides.AddSlide( i_Page, t_NewLayout ); % add Slide
posX = 200;
posY = 80;
tableW = 300;
tableH = 400;
table = invoke(t_Slide.Shapes, 'AddTable', 4, 4, posX, posY, tableW, tableH); % create Table
table.Table.Cell(1,1).Shape.TextFrame.TextRange.Text = 'items'; % add text
table.Table.Cell(1,2).Shape.TextFrame.TextRange.Text = 'data1';
table.Table.Cell(1,3).Shape.TextFrame.TextRange.Text = 'data2';
table.Table.Cell(1,4).Shape.TextFrame.TextRange.Text = 'data3';

Accepted Answer

Satoshi Furukawa
Satoshi Furukawa on 22 Apr 2021
I got it running with
t_table.Table.Columns.Item(i).Width = 120;
Where Item(i) denotes the ith column.

More Answers (0)

Categories

Find more on MATLAB Report Generator in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!