MATLAB: Programmatic Report Generation – How to Create a Report in Landscape Orientation

r2014breport generator

I am trying to create a report in landscape orientation using the following commands:
import mlreportgen.dom.*;
d = Document('test','pdf');
open(d);
sect = d.CurrentDOCXSection;
pageSize = sect.PageSize;
pageSize.Orientation = 'landscape';
I am not having success with this. Am I doing something wrong?
Thank you.

Best Answer

The orientation is set, the page size just isn't changed.
import mlreportgen.dom.*;
d = Document('test','docx');
open(d);
sect = d.CurrentDOCXSection;
pageSize = sect.PageSize;
pageSize.Orientation = 'landscape';
pageSize.Height = '8.5in';
pageSize.Width = '11in';
close(d)
rptview(d.OutputPath)
Related Question