This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
WP DELETE SECTION

WP DELETE SECTION 


 

WP DELETE SECTION ( wpDoc ; indexNumber {; count} ) 
Parameter Type   Description
wpDoc  Object in 4D Write Pro document
indexNumber  Integer in Index of the section to be deleted
count  Integer in Number of sections to be deleted
WP DELETE SECTION ( section ) 
Parameter Type   Description
section  Object in 4D Write Pro section

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.

Note: 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.

 

Example  

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)

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1842

 
PAGE CONTENTS 
 
HISTORY 

New
Created: 4D v20 R7

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20 R7)