WP DELETE SECTION
WP DELETE SECTION ( section )
WP DELETE SECTION ( wpDoc ; indexNumber {; count} )
Parâmetro | Tipo | Descrição | |
---|---|---|---|
section | Object | → | 4D Write Pro section |
wpDoc | Object | → | 4D Write Pro document |
indexNumber | Integer | → | Index of the section to be deleted |
count | Integer | → | Number of sections to be deleted |
Descrição
The WP DELETE SECTION command deletes the passed section object, or deletes one or more sections starting at indexNumber and depending on the count passed. When a section is removed, everything associated with it, including the header, footer, part of the body, anchored pictures, text boxes, and the ending section break (whether a section break or continuous section break), is also removed.
An error is raised if the WP DELETE SECTION command requests to delete all sections or if the document contains only one section.
WP DELETE SECTION re-indexes the anchorSection attribute of text boxes and pictures to adjust their anchors to their sections after changes. For example, if a document has four sections and the second section is deleted, sections 3 and 4 will become sections 2 and 3 and text boxes and pictures that were previously anchored to sections 3 and 4 will now be anchored to sections 2 and 3.
If an image or textbox is anchored to a page (e.g., page 20) and this page no longer exists after a section has been deleted, the image (or textbox) will remain in the document and will reappear on page 20 if this page ever exists again later.
Exemplos
To remove the first section of the document:
wpDoc:=WP Import document("test.wp")
// remove section 1 only (without error unless there is only one section in the document)
WP DELETE SECTION(wpDoc ; 1)
To remove section 5 of the document:
wpDoc:=WP Import document("test.wp")
// remove section 5 only
WP DELETE SECTION(wpDoc ; 5)
To remove section 5, 6 and 7 of the document:
wpDoc:=WP Import document("test.wp")
WP DELETE SECTION(wpDoc ; 5 ; 3 )
To remove all sections starting from 5:
wpDoc:=WP Import document("test.wp")
// remove all sections starting at section 5 (without error unless section 5 does not exist)
WP DELETE SECTION(wpDoc ; 5 ; MAXLONG )
To retrieve and remove section 5:
wpDoc:=WP Import document("test.wp")
// get section 5
$section:=WP Get section(wpDoc, 5)
// remove $section
WP DELETE SECTION($section)