how to do a page break in Programmatic Report Creation

1 回表示 (過去 30 日間)
Pablo
Pablo 2015 年 5 月 18 日
回答済み: Paul Kinnucan 2016 年 5 月 12 日
Hello every body !!
I have done an automatic report but need to jump to next page before some data. I have read about mlreportgen.dom.PageBreakBefore class but it doesn't work as i want.
I want to start in a new page the new chapter, I tried this:
head1 = Heading( 1 ) ;
append(myReport,head1);
append(head1,['Chapter X'], 'Title');
head1.WhiteSpace = 'pre';
head1.Style={PageBreakBefore(1)};
but not working... :(
Someone, any ideas ? Thanks in advance !!

回答 (2 件)

Sean de Wolski
Sean de Wolski 2015 年 7 月 24 日
編集済み: Sean de Wolski 2015 年 7 月 24 日
You append-ed head1 before adding the Pagebreak. You'll need to re- append it after or wait to append until it's in the ready state.

Paul Kinnucan
Paul Kinnucan 2016 年 5 月 12 日
It’s possible that the reason that the page break does not work is that the report is running in streaming mode, which means that the heading is output to the report before the page break format is set.
Also, please note that the line that assigns the PageBreakBefore format to the heading's Style property inadvertently wipes out the heading’s preexisting OutlineLevel and WhiteSpace formats.
The following script should work for both stream and in-memory mode:
head1 = Heading(1) ;
append(head1,['Chapter X'], 'Title');
head1.WhiteSpace = 'pre';
head1.Style=[head1.Style, {PageBreakBefore(1)}]; % Preserve the existing formats
append(myReport,head1); % Safest to append the headingafter setting its properties

カテゴリ

Help Center および File ExchangeTitle Pages, Tables of Contents, Lists of Figures, Tables, and Captions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by