Effacer les filtres
Effacer les filtres

How to change the position of table in Report Generator?

9 vues (au cours des 30 derniers jours)
Tong Wang
Tong Wang le 27 Juin 2018
Commenté : Tong Wang le 27 Juin 2018

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);

Réponse acceptée

Rahul Singhal
Rahul Singhal le 27 Juin 2018
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";

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Report Generator Task Examples dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by