Margins
Contents
[
Hide
]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
Field | Description |
---|---|
CUSTOM | Custom margins. |
MIRRORED | Mirrored margins. |
MODERATE | Moderate margins. |
NARROW | Narrow margins. |
NORMAL | Normal margins. |
WIDE | Wide margins. |
length |
Methods
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
marginsName | java.lang.String |
Returns: int
getName(int margins)
public static String getName(int margins)
Parameters:
Parameter | Type | Description |
---|---|---|
margins | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int margins)
public static String toString(int margins)
Parameters:
Parameter | Type | Description |
---|---|---|
margins | int |
Returns: java.lang.String