Cannot insert more than one section break with mlreportgen

2 views (last 30 days)
Hi there,
I'm doing Programmatic Report Creation, now I'm stuck at cannot insert a second section break into docx file.
I tried with my own code and example code ( referred this page ) on macOS and Windows, all failed. I doubt that is it a bug?
Here is the example code I used, I'm curious if anyone can make the second section break appear.
Platform: MATLAB 2016a, macOS 10.12.1 & Windows 10
import mlreportgen.dom.*
rpt = Document('test','docx');
append(rpt,Heading(1,'Magic Square Report','Heading 1'));
sect1 = DOCXPageLayout;
sect1.PageSize.Orientation = 'landscape';
sect1.PageSize.Height = '8.5in';
sect1.PageSize.Width = '11in';
append(rpt,Paragraph('The next page shows a magic square.'),sect1);
table = append(rpt,magic(22));
table.Border = 'solid';
table.ColSep = 'solid';
table.RowSep = 'solid';
append(rpt,Heading(1,'Magic Square Report','Heading 1'));
sect2 = DOCXPageLayout;
sect2.PageSize.Orientation = 'landscape';
sect2.PageSize.Height = '8.5in';
sect2.PageSize.Width = '11in';
append(rpt,Paragraph('The next page shows a magic square.'),sect2);
table2 = append(rpt,magic(22));
table2.Border = 'solid';
table2.ColSep = 'solid';
table2.RowSep = 'solid';
close(rpt);
rptview(rpt.OutputPath);

Accepted Answer

Paul Kinnucan
Paul Kinnucan on 14 Feb 2017
This is a known problem. See 1511151 Bug Report for a workaround.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!