MATLAB Answers

Format table for mlreportgen.ppt

20 views (last 30 days)
Tristany Armangue
Tristany Armangue on 4 Jun 2019
Answered: Rahul Singhal on 20 Jun 2019
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);

  0 Comments

Sign in to comment.

Answers (1)

Rahul Singhal
Rahul Singhal on 20 Jun 2019
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

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!