PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Inserts into a a Word Processing document:
  • an element,
  • a document,
  • a paragraph,
  • a text,
  • an image,
  • a fragment.
Inserts an object into a Word Processing document or replaces the content of current fragment. The objects that can be used are:
  • an element,
  • a document,
  • a paragraph,
  • a text,
  • an image,
  • a fragment.
Caution: This documentation presents the last features of the Word Processing control. Make sure that all the necessary modules are updated.
Example
// 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)
Versions 23 and later
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
DocInsert(WP_MyDocument, nInsertionPosition, "Text to insert at bookmark position")
ELSE
Erreur("'Bookmark 1' bookmark not found in the document")
END
New in version 23
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
DocInsert(WP_MyDocument, nInsertionPosition, "Text to insert at bookmark position")
ELSE
Erreur("'Bookmark 1' bookmark not found in the document")
END
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
DocInsert(WP_MyDocument, nInsertionPosition, "Text to insert at bookmark position")
ELSE
Erreur("'Bookmark 1' bookmark not found in the document")
END
Syntax

Inserting an element at a position Hide the details

DocInsert(<Document> , <Position> , <Element>)
<Document>: Document variable or character string (with or without quotes)
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Position>: Integer
Position where the element will be inserted. This position is expressed in number of characters.
<Element>: docElement variable
Name of docElement variable corresponding to the element to insert.

Inserting a document at a position Hide the details

DocInsert(<Document> , <Position> , <Document to Insert>)
<Document>: Document variable or character string (with or without quotes)
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Position>: Integer
Position where the element will be inserted. This position is expressed in number of characters.
<Document to Insert>: Document variable
Name of Document variable corresponding to the document to insert.

Inserting a paragraph at a position Hide the details

DocInsert(<Document> , <Position> , <Paragraph to Insert>)
<Document>: Document variable or character string (with or without quotes)
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Position>: Integer
Position where the paragraph will be inserted. This position is expressed in number of characters.
<Paragraph to Insert>: docParagraph variable
Name of docParagraph variable corresponding to the paragraph to insert.

Inserting a text at a position Hide the details

DocInsert(<Document> , <Position> , <Text to Insert>)
<Document>: Document variable or character string (with or without quotes)
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Position>: Integer
Position where the text will be inserted. This position is expressed in number of characters.
<Text to Insert>: Character string (with quotes)
Text to insert at the specified position.

Inserting an image at a position Hide the details

DocInsert(<Document> , <Position> , <Image to Insert>)
<Document>: Document variable or character string (with or without quotes)
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Position>: Integer
Position where the image will be inserted. This position is expressed in number of characters.
<Image to Insert>: Image variable
Name of Image variable that will be inserted at the specified position.

Inserting a fragment at a position Hide the details

DocInsert(<Document> , <Position> , <Fragment to Insert>)
<Document>: Document variable or character string (with or without quotes)
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Position>: Integer
Position where the fragment will be inserted. This position is expressed in number of characters.
<Fragment to Insert>: docFragment variable
Name of docFragment variable that will be inserted at the specified position.
|Caution: Syntax available from version 220071

Replacing a fragment by an object (text, document, fragment, paragraph, ...) Hide the details

DocInsert(<Fragment> , <Object to Use>)
<Fragment>: Fragment variable
Name of docFragment variable to use. The content of this fragment will be replaced by the specified object.
<Object to Use>: Variable corresponding to the object type
Objet replacing the fragment content. This object can correspond to:
Components
WINDEVWEBDEV - Server codeReports and Queries wd230mdl.dll
Linux wd230mdl.so
Minimum required version
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment