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

2 visualizaciones (últimos 30 días)
PromoCodeBSJ
PromoCodeBSJ el 11 de Oct. de 2018
Respondida: Rahul Singhal el 11 de Oct. de 2018
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?

Respuestas (1)

Rahul Singhal
Rahul Singhal el 11 de Oct. de 2018
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

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by