Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to set up report margin correctly?

조회 수: 1 (최근 30일)
John
John 2020년 10월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
The report page layout is coded this way:
import mlreportgen.dom.*
rpt = Document('myReport','pdf');
open(rpt);
p = PDFPageLayout();
p.PageSize.Orientation = 'Portrait';
p.PageSize.Height = '11in';
p.PageSize.Width = '8.5in';
% margins
p.PageMargins.Top = '0.1in'; % <<==== the top margin
p.PageMargins.Bottom = '0.3in';
p.PageMargins.Left = '0.3in';
p.PageMargins.Right = '0.3in';
append(rpt, p);
However, even by setting the TOP margins to 0, the output page always has a TOP margin about 1 inch margins.
What did I do wring?
Thank you for help!

답변 (1개)

Srivardhan Gadila
Srivardhan Gadila 2020년 11월 2일
As per the documentation of mlreportgen.dom.PageMargins class: "For PDF, the total height of the top margin equals the value of the Top property of this object plus the height of the Header property. The body text starts below the header. For Word documents, the top margin and header expand to prevent overlapping of the header and the body text. Similarly, the total height of the PDF bottom margin equals the value of the Bottom property of this object plus the height of the Footer property. The body text ends above the footer. For Word documents, the footer expands to prevent overlapping the body text."
You may also refer to Page Layout for more related information.

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by