PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Inserts an object into a Word Processing document or replaces the content of the current fragment. The objects that can be used are:
  • an element,
  • a document,
  • a paragraph,
  • a text,
  • an image,
  • a fragment,
  • Versions 25 and later
    a table of contents.
    New in version 25
    a table of contents.
    a table of contents.
Caution: This documentation presents the last features of the Word Processing control. Make sure that all the necessary modules are updated.
Example
// Insère une image à la position du curseur
// Sélection du fichier image
sFichier is string
sFichier = fImageSelect(fCurrentDir(), "", ...
"Insérer une image","JPEG (*.JPG)" + TAB + "*.jpg" + CR + ...
"PNG (*.PNG)" + TAB + "*.png" + CR + "Tous les fichiers (*.*)" + TAB + "*.*")
 
IF sFichier = "" THEN
RETURN
END
 
// Le fichier image est transféré dans une variable de type Image
img is Image
img = sFichier
 
// Déclaration d'un élément de type Image (à insérer dans le document)
elt is docElément
elt.Type = typeDocElémentImage
elt.Image.ImageBuffer = img
elt.Image.Wrapping = docWrappingAlignedOnText
 
 
// Calcul des largeurs et hauteurs de l'image présente dans l'élément
// La taille de l'image est en pixels dans la variable de type Image.
// Cette taille est convertie en mm dans l'élément (unité utilisée dans un document)
elt.Image.Width = img.Width * 25.4 / 96.0
elt.Image.Height = img.Height * 25.4 / 96.0
// Position de l'image
elt.Image.X = 0
elt.Image.Y = 0
 
DocInsert(TT_MonDocument, TT_MonDocument.Curseur, elt)
Versions 23 and later
doc is Document <- TT_MonDocument.Valeur
// Recherche de la position du signet
fragmentSignet is docFragment = doc.Bookmark["Signet 1"]
IF fragmentSignet <> Null THEN
// Insertion du texte à la fin du signet
let nPositionInsertion = fragmentSignet.EndPosition
// Insertion à proprement dite
DocInsert(TT_MonDocument, nPositionInsertion, "Texte à insérer à la position du signet")
ELSE
Error("Signet 'Signet 1' non trouvé dans le document")
END
New in version 23
doc is Document <- TT_MonDocument.Valeur
// Recherche de la position du signet
fragmentSignet is docFragment = doc.Bookmark["Signet 1"]
IF fragmentSignet <> Null THEN
// Insertion du texte à la fin du signet
let nPositionInsertion = fragmentSignet.EndPosition
// Insertion à proprement dite
DocInsert(TT_MonDocument, nPositionInsertion, "Texte à insérer à la position du signet")
ELSE
Error("Signet 'Signet 1' non trouvé dans le document")
END
doc is Document <- TT_MonDocument.Valeur
// Recherche de la position du signet
fragmentSignet is docFragment = doc.Bookmark["Signet 1"]
IF fragmentSignet <> Null THEN
// Insertion du texte à la fin du signet
let nPositionInsertion = fragmentSignet.EndPosition
// Insertion à proprement dite
DocInsert(TT_MonDocument, nPositionInsertion, "Texte à insérer à la position du signet")
ELSE
Error("Signet 'Signet 1' non trouvé dans le document")
END
Syntax

Inserting an object at a position Hide the details

<Result> = DocInsert(<Document> , <Position> , <Element>)
<Result>: docFragment variable
Versions 24 and later
docFragment variable with the inserted fragment.
New in version 24
docFragment variable with the inserted fragment.
docFragment variable with the inserted fragment.
<Document>: Document variable or character string
Document to use. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • to an variable of type Document.
<Position>: Integer
Position where the element will be inserted. This position is expressed in number of characters.
<Element>: 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.
    Versions 24 and later
    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.
    New in version 24
    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.
    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.

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

<Result> = DocInsert(<Fragment> , <Object to use>)
<Result>: docFragment variable
Versions 24 and later
docFragment variable with the inserted fragment.
New in version 24
docFragment variable with the inserted fragment.
docFragment variable with the inserted fragment.
<Fragment>: docFragment variable
Name of the variable of type docFragment to be used. The content of this fragment will be replaced with the specified object.
<Object to use>: Variable corresponding to the object type
Objet replacing the fragment content. This object can correspond to:
  • a character string.
    Versions 24 and later
    You can use the following constants in the 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.
    New in version 24
    You can use the following constants in the 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.
    You can use the following constants in the 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.
Business / UI classification: UI Code
Component: wd270mdl.dll
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment