How to keep the entire table together?

11 views (last 30 days)
John
John on 9 Dec 2020
Edited: John on 31 Dec 2020
Before updating to R2020b, the table can be kept together (if the space below isn't enough, the table is generated in next page).
However, after updated to R2020b, the same thing doesn't work any more. We noticed quite a few things stopped working in R2020b. But we found the solution.
But we cann't find solution for this, even tried parentheses with (true) for KeepLinesTogether and KeepWithNext, no chance.
How can we do to keep a table together?
(we cannot predict the page content and place a PageBreakBefore() at the right place.

Answers (1)

Ani Singh
Ani Singh on 28 Dec 2020
To know about how to start a table on the next page if it does not fit into a single page, and how to split the table if the table is longer than the page.
Please check the following links for more information:
  1. In order to ensure that the table starts on the new page, consider using PageBreakBefore class to add a page break before your object. This will specify to always start the associated object on a new page.
  2. If the table is longer than the page itself, consider the AllowBreakAcrossPages class. This will specify whether to allow a row to start on the next page when it cannot fit on the current page, or to allow it to flow to the next page when it cannot fit in one page.
  3. If your table is too wide to fit in one one page, this example shows how to fit wide tables using the Table Slicer object, and to resize columns accroding to their content.
  1 Comment
John
John on 28 Dec 2020
Edited: John on 31 Dec 2020
Those are not solutions for the topic in discussing.
(1) the space are not predictable to place the "PageBreakBefore" at fixed location;
(2) the table is NOT longer than the page itself;
(3) the table is NOT too wide either;
The topic is that a page can host a few tables. When the remaining page is not enough for the next table, it will start in next page. Before R2020b, it was done in following way and worked well:
thetable.Style = [thetable.Style {KeepLinesTogether(true)}];
thetable.TableEntriesStyle = [thetable.TableEntriesStyle {KeepWithNext(true)}];
R2020b ignores these commands and breaks the table in two pages with part in last page and part in next page.
How can it work in R2020b?

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!