WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Inserts an object in a Document variable. The objects that can be used are:
  • an element,
  • a document,
  • a paragraph,
  • a text,
  • an image,
  • a fragment,
  • a table of contents.
MyDocument is Document
// Inserts an image at the specified position
// 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
// 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
MyDocument.Insert(nInsertPosition, elt)
doc is Document <- WP_MyDocument.Value
// Find the bookmark position
fragmentBookmark is docFragment = doc.Bookmark["Bookmark 1"]
IF fragmentBookmark <> Null THEN
// Insert text at the end of bookmark
let nInsertionPosition = fragmentBookmark.EndPosition
// Actual insertion
WP_MyDocument.Insert(nInsertionPosition, "Text to insert at bookmark position")
Erreur("'Bookmark 1' bookmark not found in the document")
<Result> = <Document>.Insert(<Position> , <Element to insert>)
<Result>: docFragment variable
docFragment variable with the inserted fragment.
<Document>: Document variable or character string
Name of the variable of type Document to be used.
<Position>: Integer
Position where the element will be inserted. This position is expressed in number of characters.
<Element to insert>: Type corresponding to the element to insert
Element to insert:
  • Element: Name of the docElement variable that corresponds to the element to insert.
  • Document: Name of the Document variable that corresponds to the document to insert.
  • Paragraph: Name of the docParagraph variable that corresponds to the paragraph to insert.
  • Text in character string format: Text to Insert.
    You can use the following constants in the insertion text to manage the different possible breaks:
    docColumnBreakAdds a column break in a multicolumn section. If the section is not multicolumn, a page break is added.
    docLineBreakAdds a line break.
    docPageBreakAdds a page break.
    docParagraphBreakAdds a paragraph break to.
  • Image: Name of the Image variable that will be inserted at the specified position.
  • Fragment: Name of the docFragment variable that will be inserted at the specified position.
Business / UI classification: UI Code
Component: wd280mdl.dll
Minimum version required
  • Version 24
This page is also available for…
Click [Add] to post a comment