ReportGen HeaderRow.Style does not seem to translate to word document?

3 visualizaciones (últimos 30 días)
Hi - I'm tyring to format a table using code for a word template. I am trying to place a border above and below the header row (first row with the column headers) and (evntually) a border below the last line. I have tried to create a headerRowStyle (generic), then modify as such:
% Generic header row with buffer margins and borders
headerRowStyle = ...
{ ...
InnerMargin("2pt","2pt","2pt","2pt"), ...
Bold(true), RowSep('solid'), ...
Border('solid'),...
};
% Remove the border on left and right, keep top and bottom
HeaderRow = AT.Header.Children;
headerRowStyle{1,4}.LeftStyle = [];
headerRowStyle{1,4}.RightStyle = [];
headerRowStyle{1,4}.BottomStyle = 'solid';
headerRowStyle{1,4}.BottomColor = 'black';
headerRowStyle{1,4}.BottomWidth = '48px';
% Set the style
HeaderRow.Style = headerRowStyle;
My table is a FormalTable (called AT).
This puts a border on top, but not really on the bottom (it's very faint - that's why I tried '48px' figuring it was be insanely thick). According to the headerRowStyle, it should be as I wish:
I can change the width to any size and there is no change... Maybe I'm going about this all wrong, but I want a table like this:
What I get (no matter what I change border with to) is this:
I have to be doing something wrong obviously... Anyone konw what??? Thanks!

Respuesta aceptada

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair el 27 de En. de 2022
Editada: Harikrishnan Balachandran Nair el 27 de En. de 2022
H Thomas,
I understand that you are trying to format a table before appending it to the doc , such that it has a border line at the top and bottom , and a seperation between the header and body.
One possible way would be to set the header style as needed, and then remove the left and right border from the whole table.
You may refer to the following code for the same :
import mlreportgen.dom.*
% Create a document
d = Document('outputtest', 'docx');
open(d);
% Create a FormalTable with one header row and two body rows
AT = FormalTable({'Col1', 'Col2', 'Col3'}, {'entry11', 'entry12','entry13'; 'entry21', 'entry22','entry23'});
headerRowStyle = ...
{ ...
InnerMargin("2pt","2pt","2pt","2pt"), ...
Bold(true), RowSep('solid'), ...
Border('solid'),...
};
HeaderRow = AT.Header;
% Set the style
HeaderRow.Style = headerRowStyle;
AT.Style = {Border('single')};
AT.Style{1,1}.LeftStyle = 'none';
AT.Style{1,1}.RightStyle = 'none';
AT.Header.RowSepWidth = '48px';
append(d,AT);
% Close and view report
close(d);
rptview(d);
Please refer to the following Documentations to learn more on this :
  1 comentario
Thomas Boyd
Thomas Boyd el 28 de En. de 2022
Thanks... Haven't drilled down into the properties yet, but plugging this code in did the trick...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by