ReorderPage Method

Places page into the specified position in the page collection of the document. The page to be repositioned is specified by the index of the page in the page collection of the document. The position is indicated by the index, which the page will get after repositioning.

Applies to: Document object

Syntax

[[Let] booleanRet =] object.ReorderPage ( indexFrom, indexTo )

The ReorderPage method syntax has these parts:

Part Description
object Required. An expression, that returns an instance of the Document object.
indexFrom Required. An expression that returns a Long value. Represents the index of the page to be repositioned in the page collection of the document.
indexTo

Required. An expression that returns a Long value. Specifies the index of the position, to which the page will be placed.

booleanRet Optional. A Boolean type variable.

Remarks

If either indexFrom or indexTo are less than 1 or greater than the number of pages in the document, the RemoveMenuItem method doesn't reposition the page and returns False. If the page was repositioned, the method returns True. Use the PagesNum method to find out the number of the pages in the document.

Note, that if indexFrom is greater than indexTo, then when you reposition a page with the indexFrom index, the indices of all pages, starting from indexTo to (indexFrom - 1), will be increased by 1. If indexTo is greater than indexFrom, then when you reposition the page with the indexFrom index, the indices of all pages, starting from (indexFrom + 1) to indexTo will be decreased by 1.

Example

This example contains a document-level script. The script uses the ReorderPage method to reverse the page order of the document.

' Declare variables
Dim page_count As Long

' Remember the number of the pages in the document
Let page_count = thisDoc.PagesNum()

' Reposition pages from the last position 
' to the current, specified by the  i counter
For i=1 To page_count
    thisDoc.ReorderPage( page_count, i )
Next i

 

See Also

AddPage method, FindPage method, Page method, PageByID method, PagesNum method, RemovePage method, RemovePageByID method, ReorderPageByID method, Page object