[]
Use this class to define the top, right, bottom, and left margins applied to a watermark in a range through ILabelOptions.setMargin(Margin). You can create a margin with the same value on all sides or specify each side separately.
worksheet.getRange("A1").setValue("Draft");
Margin margin = new Margin(4, 8, 4, 8);
worksheet.getRange("A1").getLabelOptions().setMargin(margin);
Margin instance that applies the same margin value to all four sides.Use this constructor to define the watermark margin in pixels relative to a cell when the top, right, bottom, and left margins should be identical. The created margin can be applied through ILabelOptions.setMargin(Margin).
worksheet.getRange("A1").setValue("Draft");
Margin margin = new Margin(4);
worksheet.getRange("A1").getLabelOptions().setMargin(margin);
all - The value, in pixels, to set for all margins.Margin instance with separate values for each side.Use this constructor to define top, right, bottom, and left watermark margins independently before assigning the margin to label options.
Margin margin = new Margin(10, 20, 10, 20);
worksheet.getRange("A1").getLabelOptions().setMargin(margin);
top - The top margin value.right - The right margin value.bottom - The bottom margin value.left - The left margin value.The returned value is the left watermark margin, in pixels, relative to the cell.
Margin margin = new Margin(1, 2, 3, 4);
int left = margin.getLeft();
The returned value specifies the right watermark margin in pixels relative to the cell.
Margin margin = new Margin(1, 2, 3, 4);
int right = margin.getRight();
Returns the top margin value in pixels relative to the cell.
Margin margin = new Margin(1, 2, 3, 4);
int top = margin.getTop();
The returned value is the bottom watermark margin, in pixels, relative to the cell.
Margin margin = new Margin(1, 2, 3, 4);
int bottom = margin.getBottom();
The returned string contains the top, right, bottom, and left margin values in that order, separated by spaces. You can pass the returned value to StringToMargin(String) to create a Margin instance with the same margin values.