MATLAB Report Generator で作成したテーブルに​おいて、特定の列・行​の線種を変更すること​はできますか?

4 次查看(过去 30 天)
MATLAB Report Generator のドキュメント作成において、Table を挿入しています。
このとき、テーブルの任意の列(もしくは行)の線種を変更する方法を教えてください。

采纳的回答

MathWorks Support Team
DOM table の各行にアクセスするには、テーブルの row メソッドを使用します。
・mlreportgen.dom.Table.row
各列にアクセスするには、テーブルの ColSpecGroups プロパティを使用します。
・mlreportgen.dom.Table.Table.ColSpecGroups
また、テーブルの特定のエントリにアクセスするには、テーブルの entry メソッドを使用します。
・mlreportgen.dom.Table.entry
上記のメソッドやプロパティから、Border フォーマットを指定し、線種を指定します。
・mlreportgen.dom.Border class
以下は、その実行例です。
import mlreportgen.dom.*;
d = Document('mydoc','docx');
data = magic(5);
C = num2cell(data);
C = [{'d1', 'd2', 'd3', 'd4', 'd5'}; C];
t = Table(C);
% テーブル全体のフォーマット指定
t.Style = {Border('inset','black','1px'), ...
ResizeToFitContents(true)};
% テーブルの一行目のボーダーのフォーマットを指定
bottomBorder = Border();
bottomBorder.BottomStyle = 'single';
bottomBorder.BottomColor = 'black';
bottomBorder.BottomWidth = '1px';
firstRow = t.row(1);
firstRow.Style = [firstRow.Style, {bottomBorder}];
% 一列目のボーダーのフォーマットを指定
rightBorder = Border();
rightBorder.RightStyle = 'single';
grps(1) = TableColSpecGroup;
grps(1).Style = {rightBorder};
grps(1).Span = 1;
t.ColSpecGroups = grps;
% テーブルの最初のエントリの右側とボトムボーダーの仕様を指定
firstEntryBorder = Border();
firstEntryBorder.BottomStyle = 'single';
firstEntryBorder.RightStyle = 'single';
firstEntry = t.entry(1,1);
firstEntry.Style = [firstEntry.Style, {firstEntryBorder}];
append(d,t); % 追加
close(d);
rptview(d.OutputPath);

更多回答(0 个)

类别

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

标签

尚未输入任何标签。

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!