poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 63221] New: Please methods getTopMargin(), getBottomMargin(), etc, to XSSFSheet
Date Sat, 02 Mar 2019 16:22:24 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=63221

            Bug ID: 63221
           Summary: Please methods getTopMargin(), getBottomMargin(), etc,
                    to XSSFSheet
           Product: POI
           Version: 4.0.x-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: dmgauntt@uab.edu
  Target Milestone: ---

The XSSFPrintSetup class contains the methods getHeaderMargin() and
getFooterMargin().  However, Excel documents also contain top, bottom, left,
and right margin settings, so the methods getTopMargin(), getBottomMargin(),
etc, should be added.  It would also be useful to add these as methods of
XSSFSheet.

The code fragments below can be used as a template.

class XSSFPrintSetup {
        public double getTopMargin() {
                return pageMargins.getTop();
        }
}

class XSSFSheet {
        public double getTopMargin() {
                final CTPageMargins  pageMargins;
                if(worksheet.isSetPageMargins()) {
                        pageMargins = ctWorksheet.getPageMargins();
                } else {
                        pageMargins = ctWorksheet.addNewPageMargins();
                }
                return pageMargins.getTop();
        }
}

This is based on the following workaround:

        public static double getTopMargin(XSSFSheet sheet) {
                final CTWorksheet ctSheet = sheet.getCTWorksheet();
                final CTPageMargins margins = ctSheet.getPageMargins();
                return margins.getTop();
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message