Remove line present under column names in table

조회 수: 6 (최근 30일)
Sampath Rachumallu
Sampath Rachumallu 2020년 7월 1일
편집: Sampath Rachumallu 2020년 7월 1일
Hi all,
I have added some tables in word document using report generator 'Document' Class. However I am getting some lines(underlines) for column names in a table. I want to remove these lines. Kindly let me know how this can be done.
Below is the example of problem i am facing. I am attaching an image as well for your reference. I am using 2019a version.Thanks.
Age
___
38
43

채택된 답변

Rahul Singhal
Rahul Singhal 2020년 7월 1일
Hi Sampath,
To customize the horizontal rule in the table header, use the HeaderRule property of the DOM MATLABTable class. This property is an object of mlreportgen.dom.HorizontalRule class.
For example, to remove this horizontal rule, you can either unset this property or set the horizontal rule border style to be none.
% Create DOM MATLABTable object
mlTbl = mlreportgen.dom.MATLABTable(table);
Unset the header rule as shown below:
mlTbl.HeaderRule = [];
OR set the horizontal rule border to be none as shown below:
mlTbl.HeaderRule.Border = 'none';
Thanks,
Rahul

추가 답변 (1개)

SC
SC 2020년 7월 1일
You can first create an array of structs 's' with Age and 'Gender' as fields,
s(1).Age = 38;
s(1).Gender = 'Male';
s(2).Age = 43;
s(2).Gender = 'Male';
s(3).Age = 38;
s(3).Gender = 'Female';
Visit the following to see, how it is done:
and use
T = struct2table(s);
If T is a table and D is your document, you can append your table by
MT = MATLABTable(T);
append(D, MATLABTable(T));
  댓글 수: 3
Sampath Rachumallu
Sampath Rachumallu 2020년 7월 1일
Hi Walter,is it possible to format the table so that variables are not underlined?
Walter Roberson
Walter Roberson 2020년 7월 1일
Sorry, I do not know that. I have never used Report Generator.
I have encounted the fact that Report Generator supports Style Sheets, but I do not know how to get from that fact to specific representation of table objects.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by