Make first row of Formal Table bold

조회 수: 28 (최근 30일)
Jack Arnoldi
Jack Arnoldi 2019년 7월 25일
댓글: Jack Arnoldi 2019년 7월 25일
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!

채택된 답변

Rahul Singhal
Rahul Singhal 2019년 7월 25일
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
Jack Arnoldi
Jack Arnoldi 2019년 7월 25일
That's exactly what I was looking for thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by