How to centre align a table with width>100%?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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?
0 comentarios
Respuestas (1)
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.
For Report API reports see, https://www.mathworks.com/help/rptgen/ug/mlreportgen.report.report-class.html#d120e136826
For DOM API reports, see https://www.mathworks.com/help/rptgen/ug/mlreportgen.dom.document-class.html#budo6en-1_sep_shared-CurrentPageLayout
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
0 comentarios
Ver también
Categorías
Más información sobre Title Pages, Tables of Contents, Lists of Figures, Tables, and Captions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!