Cannot insert more than one section break with mlreportgen

3 次查看(过去 30 天)
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);

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator Task Examples 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by