You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2019/03/02 16:22:24 UTC
[Bug 63221] New: Please methods getTopMargin(), getBottomMargin(),
etc, to XSSFSheet
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
[Bug 63221] Please add methods getTopMargin(), getBottomMargin(),
etc, to XSSFSheet
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63221
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Please methods |Please add methods
|getTopMargin(), |getTopMargin(),
|getBottomMargin(), etc, to |getBottomMargin(), etc, to
|XSSFSheet |XSSFSheet
--
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
[Bug 63221] Please add methods getTopMargin(), getBottomMargin(),
etc, to XSSFSheet
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63221
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
Added methods to XSSFPrintSetup via r1855154, XSSFSheet already has
setMargin/getMargin which receives a constant for the margin to set and thus
this can already be used to set any of those margins.
--
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
[Bug 63221] Please methods getTopMargin(), getBottomMargin(), etc,
to XSSFSheet
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63221
--- Comment #1 from David Gauntt <dm...@uab.edu> ---
I have refined the workaround:
public static double getTopMargin(XSSFSheet sheet) {
return getPageMargins(sheet).getTop();
}
public static double getBottomMargin(XSSFSheet sheet) {
return getPageMargins(sheet).getBottom();
}
private static CTPageMargins getPageMargins(XSSFSheet sheet) {
final CTWorksheet ctSheet = sheet.getCTWorksheet();
if (ctSheet.isSetPageMargins()) {
return ctSheet.getPageMargins();
} else {
return ctSheet.addNewPageMargins();
}
}
--
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