FontSize different for numbers and strings in table object of mlreportgen.ppt.Table class
44 views (last 30 days)
Show older comments
I have a standard MATLAB table with numeric and string values in different columns to integrate into pptx file
I create table object of mlreportgen.ppt.Table, set FontSize to 8 on the table and add it to the slide like this:
vt_table_obj = mlreportgen.ppt.Table(vt_table);
vt_table_obj.FontSize = '8pt';
add(vt_slide, vt_table_obj);
But in presentation size 8 is applied only to text values, while numeric have size 10:

Why it doesn't apply to the numbers?Or it need to be set further in children entities - TableRow, TableEntry, Paragpaph, Text - levels?
3 Comments
dpb
on 30 Dec 2025 at 19:34
Edited: dpb
on 30 Dec 2025 at 19:36
Have you tried converting to the cell array? I've got the other reports open so isn't convenient at the moment to mess with the report gen stuff instead of dom to try here. Given the doc, I'm somewhat surprised it doesn't error, but I suppose the template could have been expanded and the doc just not caught up.
The problem, I would guess would be in what you haven't shown which is the prior code that creates the vt_slide object and its default sytle properties that the table will inherit. As is noted in the doc's, the priority level of "who's in charge" can make a difference in results from those expected.
And, I'd not be terribly surprised about the thing behaving differently passed the ML table as opposed to a cell array.
I'd probably try
vt_table_obj = mlreportgen.ppt.Table(vt_table{:});
as a trivial coding change to match the doc as far as the input object type.
Accepted Answer
Nazariy
on 30 Dec 2025 at 19:31
2 Comments
dpb
about 23 hours ago
Edited: dpb
12 minutes ago
That does seem a peculiar and somewhat unexpected constraint/limitation; wonder why that would be.
But, as noted, I've only just begun my first experiment with the report generator and only with Word document so hadn't seen that with the ppt.
I don't know if there's any such thing happening in the Word tables or not at this point; I'm dealing only with financial data with these and converted the numeric values to string currency representations first since there is no currency formatting in Word as in Excel to get it automagically, so all the data were string already.
I created a number of formal tables that could be formatted and stored a variable number of them in a 2D cell array for all of the subtables of a given overall table. Then that 2D cell array of table objects was loaded into an informal table to create the appearance of a single 2-column table....
ADDENDUM:
I noticed in the doc for the ppt tablet hat the row entry object content is documented only for character input; Seems like a strange limitation, but would explain the different behavior. In poking from the top down, I never found a reference to the mlreportgen.ppt.Number object; it wasn't linked to starting with the ppt.table object all the way to the bottom where the links turned back into pointing back to the top.
Peculiar...but, then again, it is a MS product...
dpb
on 31 Dec 2025 at 19:36
From the example using ppt.Number --
Create a Number object with pi and convert it to a string with the toString method.
number1Obj = Number(pi);
formattedNumber1 = toString(number1Obj);
NOTA BENE that the passing of a numeric value to Number() doesn't actually create the string representation as one would expect from MATLAB functions like num2str() but only sets the format that toString() uses when doing the conversion. Really a convoluted mess, indeed...one might as well just use compose directly and stuff the output string array into the table where wanted.
But, it is clear that the ppt Table "knows nuthink!" about numbers themselves; everything does have to be converted to text first; failing that leads to getting default representations that won't have the expected properties of the table, indeed.
Seems as though a lot of this could have been done in a much more integrated fashion in the development of the classes/methods/properties.
More Answers (0)
See Also
Categories
Find more on Tables 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!