Margins

Inheritance: java.lang.Object

public class Margins

Specifies preset margins.

Examples:

Shows when to recalculate the page layout of the document.


 Document doc = new Document(getMyDir() + "Rendering.docx");

 // Saving a document to PDF, to an image, or printing for the first time will automatically
 // cache the layout of the document within its pages.
 doc.save(getArtifactsDir() + "Document.UpdatePageLayout.1.pdf");

 // Modify the document in some way.
 doc.getStyles().get("Normal").getFont().setSize(6.0);
 doc.getSections().get(0).getPageSetup().setOrientation(Orientation.LANDSCAPE);
 doc.getSections().get(0).getPageSetup().setMargins(Margins.MIRRORED);

 // In the current version of Aspose.Words, modifying the document does not automatically rebuild
 // the cached page layout. If we wish for the cached layout
 // to stay up to date, we will need to update it manually.
 doc.updatePageLayout();

 doc.save(getArtifactsDir() + "Document.UpdatePageLayout.2.pdf");
 

Fields

FieldDescription
CUSTOMCustom margins.
MIRROREDMirrored margins.
MODERATEModerate margins.
NARROWNarrow margins.
NORMALNormal margins.
WIDEWide margins.
length

Methods

MethodDescription
fromName(String marginsName)
getName(int margins)
getValues()
toString(int margins)

CUSTOM

public static int CUSTOM

Custom margins.

MIRRORED

public static int MIRRORED

Mirrored margins.

Remarks:

Setting margins to Mirrored will set the appropriate value for PageSetup.getMultiplePages() / PageSetup.setMultiplePages(int) property. This will affect the whole document, not just the current section.

MODERATE

public static int MODERATE

Moderate margins.

NARROW

public static int NARROW

Narrow margins.

NORMAL

public static int NORMAL

Normal margins.

WIDE

public static int WIDE

Wide margins.

length

public static int length

fromName(String marginsName)

public static int fromName(String marginsName)

Parameters:

ParameterTypeDescription
marginsNamejava.lang.String

Returns: int

getName(int margins)

public static String getName(int margins)

Parameters:

ParameterTypeDescription
marginsint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int margins)

public static String toString(int margins)

Parameters:

ParameterTypeDescription
marginsint

Returns: java.lang.String