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

5 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 2 Juil 2018
MATLAB Report Generator のドキュメント作成において、Table を挿入しています。
このとき、テーブルの任意の列(もしくは行)の線種を変更する方法を教えてください。

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 2 Juil 2018
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);

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!