Can individual ColSep('solid') & RowSep('solid') be defined in mlreportge​n.dom.(For​mal)Table?

3 次查看(过去 30 天)
From Matlab examples on mlreportgen.dom.Table and mlreportgen.dom.FormalTable, the border of cells are overall defined:
tableStyle = {Width('100%'), Border('solid'), ColSep('solid'), RowSep('solid')};
t = FormalTable(data);
t.Style = [t.Style tableStyle];
t.Body.TableEntriesStyle = [t.Body.TableEntriesStyle, bodyStyle];
and
formalTable = mlreportgen.dom.FormalTable(tbl_header,traffic_camera_data);
formalTable.RowSep = "Solid";
formalTable.ColSep = "Solid";
formalTable.Border = "Solid";
Can the border of each table cell be defined individually? For example, some cell with only the bottom border.
Thanks.

采纳的回答

Rahul Singhal
Rahul Singhal 2020-9-21
Hi John,
Yes, borders can be defined for each table entry individually. This can be done by adding the Border format to that particular table entry. Doing this will override any border settings coming from the table borders, rowsep, or colsep for that entry.
Below is a sample script:
% Create a report
import mlreportgen.dom.*;
d = Document('myreport','pdf');
open(d);
% Create a table with solid borders. Also specify solid row and column separators.
t = FormalTable(magic(4));
t.Border = 'solid';
t.ColSep = 'solid';
t.RowSep = 'solid';
% Override borders for a particular table entry (second entry in second row)
te22 = t.Body.entry(2,2);
te22.Style = [te22.Style {Border('double','red','2pt')}];
% Append table to the report
append(d,t);
% Close and view the report
close(d);
rptview(d);
Below is the sample output snapshot:
Thanks,
Rahul

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by