www.gusucode.com > rptgen 案例源码程序 matlab代码 > rptgen/ApplyFOPropertytoaListExample.m

    %% Apply FO Property to a List  
% This example shows how to apply an FO property to a |List| object. Using
% the DOM API, you can set a page break property on a paragraph using |PageBreakBefore|.
% However, you cannot use the |PageBreakBefore| property on a list. Instead,
% for PDF output, you can use the FO property |'break-before'| with the
% value |'page'|.   

%%  
import mlreportgen.dom.*

d = Document('Break Before List','pdf');

p = Paragraph('First Page');
p.Style = {PageBreakBefore};
append(d, p);

p = Paragraph('Second Page');
p.Style = {PageBreakBefore};
append(d, p);

list = UnorderedList({'Earl Grey','Jasmine','Honeybush'});
list.Style = {FOProperties(FOProperty('break-before','page'))};
append(d, list);

close(d);
rptview(d.OutputPath);