/**
* 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
+ * @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) {
- _sh.setMargin(margin,size);
+ _sh.setMargin(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) {
+ _sh.setMargin(margin, size);
}
/**
/**
* 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
* @see Sheet#LeftMargin
* @see Sheet#RightMargin
* @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) {
CTPageMargins pageMargins = worksheet.isSetPageMargins() ?
worksheet.getPageMargins() : worksheet.addNewPageMargins();
switch (margin) {
- case LeftMargin:
+ case LEFT:
pageMargins.setLeft(size);
break;
- case RightMargin:
+ case RIGHT:
pageMargins.setRight(size);
break;
- case TopMargin:
+ case TOP:
pageMargins.setTop(size);
break;
- case BottomMargin:
+ case BOTTOM:
pageMargins.setBottom(size);
break;
- case HeaderMargin:
+ case HEADER:
pageMargins.setHeader(size);
break;
- case FooterMargin:
+ case FOOTER:
pageMargins.setFooter(size);
break;
default :
/**
* 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);
}
}
/**
* 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
*