フィルターのクリア

Report generator page break style not working

1 回表示 (過去 30 日間)
John Pitman
John Pitman 2023 年 9 月 15 日
コメント済み: John Pitman 2023 年 10 月 4 日
I'm having trouble with page breaks in pdf report generator.
Here is my code:
% Make layout tables
lot1 = Table({tableRun1, '',tableRun2});
lot1.Style = {Width('100%'), Border('solid','black','1px'), ...
ColSep('solid','black','1px'), ...
RowSep('solid','black','1px'), ...
ResizeToFitContents(true)};
lot2 = Table({tableExport1, '',tableExport2});
lot2.Style = [{Width('100%'), Border('solid','black','1px'), ...
ColSep('solid','black','1px'), ...
RowSep('solid','black','1px'), ...
ResizeToFitContents(true)},{PageBreakBefore(1)}];
% Add content to report
add(rpt, lot1);
add(rpt, lot2);
Below is an image of what I'm getting.
The grey is lot1, the orange is lot2, which is splitting between two pages.
Intent is for lot2 to start on the following page. It was working previously until I increased the length of the first element of lot2 by one row.
Many thanks in advance
John
  1 件のコメント
John Pitman
John Pitman 2023 年 9 月 18 日
In case anyone else has this problem, I found that increasing the margins from 1cm to 2cm rectified the problem and lot2 goes onto the next page as intended.
Still none the wiser as to why increasing the length of tableExport1 from 4 rows to 5 stops the page break from working with the 1cm margins though.

サインインしてコメントする。

採用された回答

Yash
Yash 2023 年 10 月 3 日
Hi John,
I understand that you are facing issues while adding page breaks in report generator using MATLAB.
I have reproduced the issue at my end using MATLAB R2022b, I discovered that this issue only arises if the combined size of "lot1" and "lot2" exceeds the page size. If the combined size is smaller, the page break functions as expected.
To overcome this issue, I have identified a workaround that works in both cases. Instead of using the "mlreportgen.dom.PageBreakBefore" class, you can use the "mlreportgen.dom.PageBreak" class.
Refer to the below code for the implementation:
% Create a Page Break Object
breakObj = mlreportgen.dom.PageBreak()
% Add content to report
add(rpt, lot1);
add(rpt, breakObj);
add(rpt, lot2);
The documentation of the "mlreportgen.dom.PageBreak" class is available at the link provided below:
I hope this addresses your query.
Best Regards,
Yash
  1 件のコメント
John Pitman
John Pitman 2023 年 10 月 4 日
I haven't tested this but sounds like a solution.
Thanks very much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeReporting and Database Access についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by