How to change the position of table in Report Generator?

4 次查看(过去 30 天)

I set the paper to 'landscape', then i put a table on that, but you can see above the table, there is a big area of blank(red line), i want to move the top of table to green line, how could i do this? I also have the code below.

 import mlreportgen.dom.*
d = Document('formal','pdf');
open(d)
% Set Orientation
s = d.CurrentPageLayout;
s.PageSize.Orientation  ='landscape';
s.PageSize.Height = '8.264in';
s.PageSize.Width = '11.694in';
img = Image(which('b747.jpg'));
img.Style = {ScaleToFit};
table = Table({img, Paragraph('Entry 2')});
table.Border = 'solid';
table.Width = '2in';
table.entry(1,1).Style = {Height('5in'), Width('8in')};
table.entry(1,2).Border = 'solid';
% Add a row
row1 = TableRow;
append(row1, TableEntry('entry 11'));
append(table,row1);
append(d,table);
close(d);
rptview(d.OutputPath);

采纳的回答

Rahul Singhal
Rahul Singhal 2018-6-27
Hi Tong,
The default layout of the page defines the size for the page margins (top, bottom, left, right) to be "1in" each and also the size for headers and footers to be "0.5in" each. This comes out to be the blank area in your report. You can manipulate these sizes to get the desired output. These can be accessed as:
s = d.CurrentPageLayout;
% To change top-margin to "0in"
s.PageMargins.Top = "0in";

更多回答(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