Make first row of Formal Table bold
16 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
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
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!