Make first row of Formal Table bold
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jack Arnoldi
le 25 Juil 2019
Commenté : Jack Arnoldi
le 25 Juil 2019
Hello I have a Formal Table and I want the first row to be bold. I know you can make the first column bold with
grps(1) = TableColSpecGroup;
specs(1) = TableColSpec;
specs(1).Style = {Bold()};
grps(1).ColSpecs = specs;
mytab.ColSpecGroups = grps;
but I don't know how to the same thing with the rows... Can someone help me with this?
Thank you in advance!
0 commentaires
Réponse acceptée
Rahul Singhal
le 25 Juil 2019
Hi Jack,
I think you want the header row of the FormalTable to be bold.
Below example demostrates how to style the header first row as well as the first row of the table body.
import mlreportgen.dom.*
% Create a document
d = Document('output', 'pdf');
open(d);
% Create a FormalTable with one header row and two body rows
t = FormalTable({'Col1', 'Col2'}, {'entry11', 'entry12'; 'entry21', 'entry22'});
t.Border = 'solid';
t.RowSep = 'solid';
t.ColSep = 'solid';
t.Width = '4in';
% Specify styles for the header first row
headerRow = t.Header.Children(1);
headerRow.Style = [headerRow.Style {Bold()}];
% Specify styles for the first row of table body
bodyFirstRow = t.Body.Children(1);
bodyFirstRow.Style = [bodyFirstRow.Style {Color('red')}];
% Append table to the document
append(d,t);
% Close and view report
close(d);
rptview(d);
Hope this helps!
Thanks,
Rahul
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!