Borrar filtros
Borrar filtros

Report generator page break style not working

1 visualización (últimos 30 días)
John Pitman
John Pitman el 15 de Sept. de 2023
Comentada: John Pitman el 4 de Oct. de 2023
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 comentario
John Pitman
John Pitman el 18 de Sept. de 2023
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.

Iniciar sesión para comentar.

Respuesta aceptada

Yash
Yash el 3 de Oct. de 2023
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 comentario
John Pitman
John Pitman el 4 de Oct. de 2023
I haven't tested this but sounds like a solution.
Thanks very much

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Reporting and Database Access en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by