How to centre align a table with width>100%?

조회 수: 3 (최근 30일)
PromoCodeBSJ
PromoCodeBSJ 2018년 10월 11일
답변: Rahul Singhal 2018년 10월 11일
With the report generator toolkit, I am trying to create a table that has a width of greater than 100% and then trying to align that to the centre or offset to the left so all the data fits into the page. How do I do this?
Data=array2table(Data,'VariableNames',String(1:7));
%convert the table and change some properties for
%aesthetics
Data=Table(Data);
%Data.RowNamesRule=false;
Data.Border='solid';
Data.ColSep='solid';
Data.RowSep='solid';
Data.HAlign='center';
%Data.OuterLeftMargin='1px'
Data.Width='105%';
Currently this just makes data pour over the right hand side like so:
I have already tried setting HAlign to centre or left and changing the left margin to a small number such as 1px, but that did not work. Any solutions?

답변 (1개)

Rahul Singhal
Rahul Singhal 2018년 10월 11일
If the Width of a Table is defined in percentage, it denotes the percentage of the page width it should take to render that table. So, a value greater than 100% will make the table overflow the page boundaries. I would suggest you to use a value less than 100% or use some fixed value, like '5in'.
If you do not wish to reduce the size of the table, you can also update the current page layout of your report to change orientation (make page landscape) or update page size, so that the page will be wide enough to render the table. Below links might be helpful.
Starting R2018b, you can even slice your wide tables vertically into multiple slices, where each slice is small enough to fit legibly on a page, see https://www.mathworks.com/help/rptgen/ug/mlreportgen.utils.tableslicer-class.html

카테고리

Help CenterFile Exchange에서 Title Pages, Tables of Contents, Lists of Figures, Tables, and Captions에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by