![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/364078/image.jpeg)
Can individual ColSep('solid') & RowSep('solid') be defined in mlreportgen.dom.(Formal)Table?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
John
le 18 Sep 2020
Réponse apportée : Rahul Singhal
le 21 Sep 2020
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.
0 commentaires
Réponse acceptée
Rahul Singhal
le 21 Sep 2020
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/364078/image.jpeg)
Thanks,
Rahul
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Report Generator Task Examples dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!