RegionBA after = (RegionBA) pagemaster.getRegion(Constants.FO_REGION_AFTER);
attrib.setTwips(RtfPage.PAGE_WIDTH, pagemaster.getPageWidth());
attrib.setTwips(RtfPage.PAGE_HEIGHT, pagemaster.getPageHeight());
Length pageTop = pagemaster.getCommonMarginBlock().marginTop;
Length pageBottom = pagemaster.getCommonMarginBlock().marginBottom;
Length pageLeft = pagemaster.getCommonMarginBlock().marginLeft;
Length pageRight = pagemaster.getCommonMarginBlock().marginRight;
Length bodyTop = pageTop;
Length bodyBottom = pageBottom;
Length bodyLeft = pageLeft;
Length bodyRight = pageRight;
if (body != null) {
// Should perhaps be replaced by full reference-area handling.
CommonMarginBlock bodyMargin = body.getCommonMarginBlock();
bodyTop = (Length) NumericOp.addition(pageTop, bodyMargin.marginTop);
bodyBottom = (Length) NumericOp.addition(pageBottom, bodyMargin.marginBottom);
bodyLeft = (Length) NumericOp.addition(pageLeft, bodyMargin.marginLeft);
bodyRight = (Length) NumericOp.addition(pageRight, bodyMargin.marginRight);
}
attrib.setTwips(RtfPage.MARGIN_TOP, bodyTop);
attrib.setTwips(RtfPage.MARGIN_BOTTOM, bodyBottom);
attrib.setTwips(RtfPage.MARGIN_LEFT, bodyLeft);
attrib.setTwips(RtfPage.MARGIN_RIGHT, bodyRight);
//region-before attributes
Length beforeTop = pageTop;
if (before != null) {
beforeTop = (Length) NumericOp.addition(pageTop, before.getExtent());
}
attrib.setTwips(RtfPage.HEADERY, beforeTop);
//region-after attributes
Length afterBottom = pageBottom;
if (after != null) {
afterBottom = (Length) NumericOp.addition(pageBottom, after.getExtent());
}
attrib.setTwips(RtfPage.FOOTERY, beforeTop);
} catch (Exception e) {