Format table for mlreportgen.ppt

I am creating a presentation programmatically for the results of my code. I have various tables that I insert in those slides, I have been able to format font size and boldface, for example, but have not been able to format table borders. Currently the tables display without any borders, I would like to add all borders. My code for one of those tables is below:
paramTable = Table();
% First row of table
tr1 = TableRow();
tr1.Style = {Bold(true),FontSize('10pt')};
% First row cells
tr1te1Text = Paragraph('');
tr1te2Text = Paragraph('AAA');
tr1te1 = TableEntry();
tr1te2 = TableEntry();
append(tr1te1,tr1te1Text);
append(tr1te2,tr1te2Text);
append(tr1,tr1te1);
append(tr1,tr1te2);
% Second row
tr2 = TableRow();
tr2.Style = {FontSize('10pt')};
% Second row cells
tr2te1Text = Paragraph('XXX');
tr2te2Text = Paragraph('YYY');
tr2te1 = TableEntry();
tr2te2 = TableEntry();
append(tr2te1,tr2te1Text);
append(tr2te2,tr2te2Text);
append(tr2,tr2te1);
append(tr2,tr2te2);
append(paramTable,tr1);
append(paramTable,tr2);
table = find(textSlide,'Table');
replace(table,paramTable);

Answers (1)

Hi Tristany,
Currently, the programmatic table formating options are limited for the PowerPoint API and the team is working to introduce these options in the future releases.
For your use case, you can alternatively use the StyleName property of the Table to get the desired output.
To get the list of valid table style names in a presentation, you can use mlreportgen.ppt.Presentation.getTableStyleNames.
As an example, to just add borders to your table, you can use 'No Style, Table Grid' style name as:
paramTable = Table();
paramTable.StyleName = 'No Style, Table Grid';
Thanks,
Rahul

Categories

Products

Release

R2017a

Asked:

on 4 Jun 2019

Answered:

on 20 Jun 2019

Community Treasure Hunt

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

Start Hunting!