Make first row of Formal Table bold

16 visualizaciones (últimos 30 días)
Jack Arnoldi
Jack Arnoldi el 25 de Jul. de 2019
Comentada: Jack Arnoldi el 25 de Jul. de 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!

Respuesta aceptada

Rahul Singhal
Rahul Singhal el 25 de Jul. de 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
  1 comentario
Jack Arnoldi
Jack Arnoldi el 25 de Jul. de 2019
That's exactly what I was looking for thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by