| 4D v18WP INSERT PICTURE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v18
 WP INSERT PICTURE 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WP INSERT PICTURE ( targetObj ; picture ; mode {; rangeUpdate} ) | ||||||||
| Parameter | Type | Description | ||||||
| targetObj | Object |   | Range or element or 4D Write Pro document | |||||
| picture | Picture |   | Picture field or variable, or path to picture file on disk | |||||
| mode | Longint |   | Insertion mode | |||||
| rangeUpdate | Longint |   | Range update mode | |||||
The WP INSERT PICTURE command inserts the picture in the targetObj according to the specified insertion mode and rangeUpdate parameter. The picture will be inserted as a character in the targetObj.
In targetObj, pass:
In picture, you can pass:
Any picture format supported by 4D can be used (see the Pictures section). You can get the list of available picture formats using the PICTURE CODEC LIST command. If the picture encapsulates several formats (codecs), 4D Write Pro only keeps one format for display and one format for printing (if different) in the document; the "best" formats are automatically selected.
In the mode parameter, pass one of the following constants to indicate the insertion mode to be used on the picture in the document:
| Constant | Type | Value | Comment | 
| wk append | Longint | 2 | Insert contents at end of target | 
| wk prepend | Longint | 1 | Insert contents at beginning of target | 
| wk replace | Longint | 0 | Replace target contents | 
| Constant | Type | Value | Comment | 
| wk exclude from range | Longint | 1 | Inserted contents not included in updated range | 
| wk include in range | Longint | 0 | Inserted contents included in updated range (default) | 
In the following example, a user selects the picture they want to insert into the range object and will be warned if this picture could not be inserted:
 
 C_OBJECT($wpRange)
 $wpRange:=WP Get selection([EXAMPLES]wpDoc)
 
 C_BOOLEAN($fail)
 $fail:=False
 
  //ask user to choose a picture on the disk that they want to insert
 $imgRef:=Open document("")
  //if user does not cancel
 If(OK=1)
  //if the file is a supported picture file
    If(Is picture file(document))
  // insert picture selected by user
       WP INSERT PICTURE($wpRange;document;wk replace)
    Else
       $fail:=True
    End if
 Else
    $fail:=True
 End if
  //if the insertion failed, alert the user
 If($fail)
    ALERT("Picture insertion failed")
 End if
	Product:  4D
	Theme:  4D Write Pro Language
	Number:  
        1437
        
        
        
	
	Created:  4D v16
	Modified:  4D v17 R5
	
	
	4D Write Pro Reference ( 4D v18)
	
	
	
 Add a comment
Add a comment