Click or drag to resize

DocumentGetPageSize Property

Gives page size width and height

Namespace:  SOWIDocument.Word
Assembly:  SOWIDocument.Word (in SOWIDocument.Word.dll) Version: 22.2.10.1 (22.2.10.450)
Syntax
public int[] GetPageSize { get; }

Property Value

Type: Int32
Remarks
Return as a integer array. First value is width and second is height
Examples
This example read page size properties and check has value otherwise set defaults value
//* page size properties width and height *
int[] lPageSize = this.Document.GetPageSize;

if (lPageSize[0] == 0)
{
    //* default page size A4: width, height *
    lPageSize = new int[] { 11906, 16838 };
}
This example create a new section property and sets page size
//* create a section properties with page size *
DocumentFormat.OpenXml.Wordprocessing.SectionProperties lSectionProperties = new DocumentFormat.OpenXml.Wordprocessing.SectionProperties
    (
        new DocumentFormat.OpenXml.Wordprocessing.PageSize
        {
            Width = DocumentFormat.OpenXml.UInt32Value.FromUInt32((uint)lPageSize[0]),
            Height = DocumentFormat.OpenXml.UInt32Value.FromUInt32((uint)lPageSize[1])
        }
    );
See Also