How to change the position of table in Report Generator?

조회 수: 4 (최근 30일)
Tong Wang
Tong Wang 2018년 6월 27일
댓글: Tong Wang 2018년 6월 27일

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