필터 지우기
필터 지우기

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 CenterFile Exchange에서 Reporting 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