Apply footer/header margins from page layout
This commit is contained in:
parent
df172d504d
commit
2b7d1142c0
1 changed files with 12 additions and 0 deletions
|
@ -1776,6 +1776,9 @@ public class TextParser extends Parser {
|
|||
inHeader = true;
|
||||
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
||||
if (currentMasterPage != null) {
|
||||
String pageLayoutName = masterPage.getPageLayoutName();
|
||||
PageLayout pageLayout = ofr.getPageLayout(pageLayoutName);
|
||||
String marginBottom = pageLayout.getFooterProperty(FO_MARGIN_BOTTOM);
|
||||
if (pageNum % 2 == 0) {
|
||||
headerNode = masterPage.getHeaderLeft();
|
||||
}
|
||||
|
@ -1785,6 +1788,9 @@ public class TextParser extends Parser {
|
|||
if (headerNode != null) {
|
||||
//Create header element
|
||||
Element headerElement = converter.createElement("header");
|
||||
if (marginBottom != null) {
|
||||
headerElement.setAttribute("style", "margin-bottom:"+getPageSc().scale(marginBottom)+";");
|
||||
}
|
||||
Node pageNode = node.getParentNode();
|
||||
pageNode.insertBefore(headerElement, node);
|
||||
traverseBlockText(headerNode, headerElement);
|
||||
|
@ -1801,6 +1807,9 @@ public class TextParser extends Parser {
|
|||
inFooter = true;
|
||||
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
||||
if (currentMasterPage != null) {
|
||||
String pageLayoutName = masterPage.getPageLayoutName();
|
||||
PageLayout pageLayout = ofr.getPageLayout(pageLayoutName);
|
||||
String marginTop = pageLayout.getFooterProperty(FO_MARGIN_TOP);
|
||||
if (pageNum % 2 == 0) {
|
||||
footerNode = masterPage.getFooterLeft();
|
||||
}
|
||||
|
@ -1810,6 +1819,9 @@ public class TextParser extends Parser {
|
|||
if (footerNode != null) {
|
||||
//Create footer element
|
||||
Element footerElement = converter.createElement("footer");
|
||||
if (marginTop != null) {
|
||||
footerElement.setAttribute("style", "margin-top:"+getPageSc().scale(marginTop)+";");
|
||||
}
|
||||
Node pageNode = node.getParentNode();
|
||||
pageNode.appendChild(footerElement);
|
||||
traverseBlockText(footerNode, footerElement);
|
||||
|
|
Loading…
Add table
Reference in a new issue