diff options
Diffstat (limited to 'poi')
-rw-r--r-- | poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 31 | ||||
-rw-r--r-- | poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java | 14 |
2 files changed, 39 insertions, 6 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index e9f6377402..c94c35e6e8 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -1341,20 +1341,41 @@ public final class HSSFSheet implements Sheet { /** * Sets the size of the margin in inches. * - * @param margin which margin to get - * @param size the size of the margin + * @param margin which margin to set + * @param size the size of the margin + * @see Sheet#LeftMargin + * @see Sheet#RightMargin + * @see Sheet#TopMargin + * @see Sheet#BottomMargin + * @see Sheet#HeaderMargin + * @see Sheet#FooterMargin + * @deprecated use {@link #setMargin(PageMargin, double)} instead */ @Override + @Deprecated + @Removal(version = "7.0.0") public void setMargin(short margin, double size) { + setMargin(PageMargin.getByShortValue(margin), size); + } + + /** + * Sets the size of the margin in inches. + * + * @param margin which margin to set + * @param size the size of the margin + * @since POI 5.2.3 + */ + @Override + public void setMargin(PageMargin margin, double size) { switch (margin) { - case FooterMargin: + case FOOTER: _sheet.getPageSettings().getPrintSetup().setFooterMargin(size); break; - case HeaderMargin: + case HEADER: _sheet.getPageSettings().getPrintSetup().setHeaderMargin(size); break; default: - _sheet.getPageSettings().setMargin(margin, size); + _sheet.getPageSettings().setMargin(margin.getLegacyApiValue(), size); } } diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java b/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java index 5899795817..f3141a8162 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/Sheet.java @@ -642,12 +642,24 @@ public interface Sheet extends Iterable<Row> { /** * Sets the size of the margin in inches. * - * @param margin which margin to get + * @param margin which margin to set * @param size the size of the margin + * @deprecated use {@link #setMargin(PageMargin, double)} instead */ + @Deprecated + @Removal(version = "7.0.0") void setMargin(short margin, double size); /** + * Sets the size of the margin in inches. + * + * @param margin which margin to set + * @param size the size of the margin + * @since POI 5.2.3 + */ + void setMargin(PageMargin margin, double size); + + /** * Answer whether protection is enabled or disabled * * @return true => protection enabled; false => protection disabled |