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

5 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 2 de Jul. de 2018
Respondida: MathWorks Support Team el 2 de Jul. de 2018
MATLAB Report Generator のドキュメント作成において、Table を挿入しています。
このとき、テーブルの任意の列(もしくは行)の線種を変更する方法を教えてください。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 2 de Jul. de 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);

Más respuestas (0)

Categorías

Más información sobre MATLAB Report Generator en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!