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