MATLAB: Can individual ColSep(‘solid’) & RowSep(‘solid’) be defined in mlreportge​n.dom.(For​mal)Table

MATLABMATLAB Report Generatormlreportgen.dom.formaltablemlreportgen.dom.tablereport generator

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.

Best Answer

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