Class PageSetup
Represents the page setup and layout settings for a section in the document.
Inheritance
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class PageSetup : Object
Constructors
PageSetup()
Initialize a new instance of PageSetup with default settings.
Declaration
public PageSetup()
Properties
BottomMargin
Gets or sets the margin size at the bottom of the page in twips.
Declaration
public double BottomMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Footer
Gets or sets height of the page footer in twips.
Declaration
public double Footer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Gutter
Gets or sets print Gutter of the page in twips.
Declaration
public double Gutter { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Header
Gets or sets height of the page header in twips.
Declaration
public double Header { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
LeftMargin
Gets or sets the margin size at the left of the page in twips.
Declaration
public double LeftMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Orientation
Gets or sets the paper orientation.
Declaration
public PageOrientation Orientation { get; set; }
Property Value
| Type | Description |
|---|---|
| PageOrientation |
PaperSize
Gets or sets the paper size.
Declaration
public PaperSize PaperSize { get; set; }
Property Value
| Type | Description |
|---|---|
| PaperSize |
RightMargin
Gets or sets the margin size at the right of the page in twips.
Declaration
public double RightMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
TopMargin
Gets or sets the margin size at the top of the page in twips.
Declaration
public double TopMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
GetBottomMargin(MeasurementUnit)
Gets the bottom margin of the document page.
Declaration
public double GetBottomMargin(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the bottom margin. |
Returns
| Type | Description |
|---|---|
| System.Double | The bottom margin of the document page in the specified measurement unit. |
GetFooterHeight(MeasurementUnit)
Gets the footer height of the document page.
Declaration
public double GetFooterHeight(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the footer height. |
Returns
| Type | Description |
|---|---|
| System.Double | The footer height of the document page in the specified measurement unit. |
GetGutter(MeasurementUnit)
Gets the gutter size of the document page.
Declaration
public double GetGutter(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the gutter size. |
Returns
| Type | Description |
|---|---|
| System.Double | The gutter size of the document page in the specified measurement unit. |
GetHeaderHeight(MeasurementUnit)
Gets the header height of the document page.
Declaration
public double GetHeaderHeight(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the header height. |
Returns
| Type | Description |
|---|---|
| System.Double | The header height of the document page in the specified measurement unit. |
GetHeight(MeasurementUnit)
Gets the height of the document page.
Declaration
public double GetHeight(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the height. |
Returns
| Type | Description |
|---|---|
| System.Double | The height of the document page in the specified measurement unit. |
GetLeftMargin(MeasurementUnit)
Gets the left margin of the document page.
Declaration
public double GetLeftMargin(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the left margin. |
Returns
| Type | Description |
|---|---|
| System.Double | The left margin of the document page in the specified measurement unit. |
GetRightMargin(MeasurementUnit)
Gets the right margin of the document page.
Declaration
public double GetRightMargin(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the right margin. |
Returns
| Type | Description |
|---|---|
| System.Double | The right margin of the document page in the specified measurement unit. |
GetTopMargin(MeasurementUnit)
Gets the top margin of the document page.
Declaration
public double GetTopMargin(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the top margin. |
Returns
| Type | Description |
|---|---|
| System.Double | The top margin of the document page in the specified measurement unit. |
GetWidth(MeasurementUnit)
Gets the width of the document page.
Declaration
public double GetWidth(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The desired unit of measurement for the width. |
Returns
| Type | Description |
|---|---|
| System.Double | The width of the document page in the specified measurement unit. |
SetBottomMargin(Double, MeasurementUnit)
Sets the bottom margin for the document.
Declaration
public void SetBottomMargin(double bottomMargin, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | bottomMargin | The size of the bottom margin. |
| MeasurementUnit | measurementUnit | The unit of measurement for the bottom margin size. |
Remarks
Use this method to set the size of the bottom margin for the document.
SetCustomPaperSize(Double, Double, MeasurementUnit)
Sets a custom paper size for the document.
Declaration
public void SetCustomPaperSize(double width, double height, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | The width of the custom paper size. |
| System.Double | height | The height of the custom paper size. |
| MeasurementUnit | measurementUnit | The unit of measurement for the custom paper size dimensions. |
Remarks
Use this method to set a custom paper size for the document. The width and height must be positive values, otherwise, an System.ArgumentOutOfRangeException is thrown.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown if the width or height is a negative value. |
SetCustomPaperSize(Int32, Int32)
Sets a custom paper size for the document.
Declaration
public void SetCustomPaperSize(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | width | The width of the custom paper size in twips. |
| System.Int32 | height | The height of the custom paper size in twips. |
Remarks
Use this method to set a custom paper size for the document. The width and height must be positive values, otherwise, an System.ArgumentOutOfRangeException is thrown.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown if the width or height is a negative value. |
SetFooterHeight(Double, MeasurementUnit)
Sets the footer height for the document.
Declaration
public void SetFooterHeight(double footerHeight, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | footerHeight | The size of the footer height . |
| MeasurementUnit | measurementUnit | The unit of measurement for the footer height size. |
Remarks
Use this method to set the size of the footer height for the document.
SetGutter(Int32, MeasurementUnit)
Sets the gutter size for the document.
Declaration
public void SetGutter(int gutter, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | gutter | The size of the gutter. |
| MeasurementUnit | measurementUnit | The unit of measurement for the gutter size. |
Remarks
The gutter size is used to specify additional space on the right margin. It is typically used for binding purposes in printed documents.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown if the provided gutter size is negative. |
SetHeaderHeight(Int32, MeasurementUnit)
Sets the header height for the document.
Declaration
public void SetHeaderHeight(int headerHeight, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | headerHeight | The size of the header height. |
| MeasurementUnit | measurementUnit | The unit of measurement for the header height size. |
Remarks
Use this method to set the size of the header height for the document.
SetLeftMargin(Int32, MeasurementUnit)
Sets the left margin for the document.
Declaration
public void SetLeftMargin(int leftMargin, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | leftMargin | The size of the left margin. |
| MeasurementUnit | measurementUnit | The unit of measurement for the left margin size. |
Remarks
Use this method to set the size of the left margin for the document.
SetRightMargin(Double, MeasurementUnit)
Sets the right margin for the document.
Declaration
public void SetRightMargin(double rightMargin, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | rightMargin | The size of the right margin. |
| MeasurementUnit | measurementUnit | The unit of measurement for the right margin size. |
Remarks
Use this method to set the size of the right margin for the document.
SetTopMargin(Double, MeasurementUnit)
Sets the top margin for the document.
Declaration
public void SetTopMargin(double topMargin, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | topMargin | The size of the top margin. |
| MeasurementUnit | measurementUnit | The unit of measurement for the top margin size. |
Remarks
Use this method to set the size of the top margin for the document.