The
docElementImage type is used to handle the characteristics of an Image element found in a
docElement variable.
The characteristics of docElementImage variable can be handled by several WLanguage properties.
CAUTION: This type cannot be used directly. It must be used via the docElement type.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable.
// Inserts an image cursor location
// Select the image file
sFile is string
sFile = fImageSelect(fCurrentDir(), "", ...
"Insert an image","JPEG (*.JPG)" + TAB + "*.jpg" + CR + ...
"PNG (*.PNG)" + TAB + "*.png" + CR + "All files (*.*)" + TAB + "*.*")
IF sFile = "" THEN
RETURN
END
// The image file is transferred into an Image variable
img is Image
img = sFile
// Declare an Image element (that will be inserted into the document)
elt is docElement
elt.Type = typeDocElementImage
elt.Image.BufferImage = img
elt.Image.Wrapping = docWrappingAlignedOnText
// Calculate the width and height of the image found in the element
// The image size is expressed in pixels in the Image variable.
// This size is converted into mm in the element (unit used in a document)
elt.Image.Width = img.Width * 25.4 / 96.0
elt.Image.Height = img.Height * 25.4 / 96.0
// Image position
elt.Image.X = 0
elt.Image.Y = 0
DocInsert(WP_MyDocument, WP_MyDocument.Cursor, elt)
Remarks
Properties specific to the description of docElementImage variables
The following properties can be used to handle a docElementImage variable:
| | |
Property name | Type used | Effect |
---|
Height | Real | Image height in millimeters. Caution: the unit used is the millimeter instead of the pixel (not enough precision). Don't forget to convert (if necessary) the image height from pixels to millimeters. |
ImageBuffer | Image | Image buffer. |
ImageLink | Character string | Link to the Image file. The actual image will not be integrated into the document, but only a link to the image. |
Width | Real | Width of the image in millimeters. Caution: the unit used is the millimeter instead of the pixel (not enough precision). Don't forget to convert (if necessary) the image width from pixels to millimeters. |
Wrapping | Integer constant | Type of image wrapping: - docWrappingAlignedOnText: The image inserted into the line and it is linked to the text location where it was inserted. It is processed like any character. It moves with the text.
- docWrappingThrough: Used to customize the wrapping.
- docWrappingBehindTheText: Allows you to use the image in watermark behind the text.
- docWrappingBeforeTheText: Used to display the image above the text.
- docWrappingFramed: Wraps the text around the image border (recommended for a square image).
- docWrappingTopAndBottom: The image remains on its line and it is located between two text sections at the top and at the bottom.
- docWrappingNear: Wraps the image according to its outlines (recommended for a round image or for an image with an irregular shape).
|
X | Real | X-position of the image in relation to its anchoring point (in millimeters). This property is used only for images for which the Wrapping property is set to a constant other than docWrappingAlignedOnText. |
Y | Real | Y-position of the image in relation to its anchoring point (in millimeters). This property is used only for images for which the Wrapping property is set to a constant other than docWrappingAlignedOnText. |
ZOrder | Integer | Number corresponding to the Z-order of the image. |