ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Word Processing functions / Types of variables
  • Properties specific to docElement variables
  • Functions that use docElement variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The docElement type handles each element in a docParagraph variable.
You can define and change the characteristics of this element using different WLanguage functions and properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Ouvre un fichier docx dans le champ Traitement de texte
TT_MonDoc = DocOpen(fExeDir() + fSep() + "MonDoc.docx")

// Fragment positionné à la fin du document
fFin is docFragment(TT_MonDoc, -1)
// Sélectionne le document
FragmentTexte is docFragment(TT_MonDoc, 1, fFin.EndPosition)

FOR EACH MonElementCourant OF FragmentTexte.Element
	MonParagraphe is docParagraph = MonElementCourant.Paragraphe
	Trace(MonParagraphe.StartPosition)
	Trace(MonParagraphe.EndPosition)
END
// Ouvre un fichier docx dans le champ Traitement de texte
TT_MonDoc = DocOpen(fExeDir() + fSep() + "MonDoc.docx")
MonDoc is Document = TT_MonDoc
// Parcours les paragraphes pour trouver les interrupteurs
sElement is string
sParagraphe is string
sValeur,sDebut,sFin,sType are strings
FOR EACH MonPara OF MonDoc.Paragraph
	sParagraphe = sParagraphe + [CR] + sElement
	sElement = ""
	FOR EACH MonElement OF MonPara.Element
		sDebut = MonElement.PositionDébut
		sFin = MonElement.PositionFin
		SWITCH MonElement.Type
			CASE typeDocElementCheckBoxControl
			sType = "Case à cocher"
			CheckBox is docElementCheckBox <- MonElement..Control
			sValeur = CheckBox.Checked
		END
		sElement = sElement + [CR] + sValeur + TAB + sDebut + TAB + sFin + TAB + sType
	END
END
Properties

Properties specific to docElement variables

The following properties can be used to define the characteristics of docElement variables:
Property nameType usedEffect
CelldocCell variableCell characteristics (only if the element corresponds to a table cell).
ChampField characteristics (e.g. Check Box control field).
For Check Box control fields, use the elt;- operator to retrieve the switch's characteristics..
Example:
CheckBox is docElementCheckBox <- MonElement..Control
EndPositionIntegerEnd position of element in the document.
This property is read-only.
FormuladocElementFormula variableFormula characteristics: formula, formula formatting, formula result (only for formula elements).
ImagedocElementImage variableImage characteristics (can be used for an Image element only).
LinkdocElementLink variableLink characteristics (only if the element corresponds to a link).
These characteristics are available in read-only.
ParagraphdocParagraph variableParagraph that contains the element.
ParentdocElement variableElement that contains the element.
This property is read-only.
StartPositionIntegerStart position of element in the document.
This property is read-only.
TableOfContentsdocTableOfContents variableCharacteristics of the table of contents of the document.
TextdocElementText variableText characteristics (can be used for a Text element only).
TextAreadocElementTextArea variableCharacteristics of text area (can be used for a Text Area element only).
TypeIntegerType of element corresponding to one of the following constants:
  • typeDocCellElement Cell type element of an array.*=
  • typeDocElementSwitchField Check Box control element (check box on a form).
  • typeDocDocumentElement Document type element.
  • typeDocHeaderElement Page header element.
  • typeDocFormulaElement Element of type Formula
  • typeDocImageElement Image element.
  • typeDocUnrecognizedElement Unrecognized element type.
  • typeDocLinkElement Link element.
  • typeDocParagraphElement Paragraph element with no text (empty text).
  • typeDocFooterElement Footer element.
  • typeDocTableOfContents element Table of contents element.
  • typeDocTextElement Text element.
  • typeDocTextBoxElement Text area element type.
Remarks

Functions that use docElement variables

DocAddAdds:
  • at the end of a word processing document: an element, document, paragraph, text, image or fragment.
  • at the end of a fragment: an element, text or image.
DocChangeZOrderChanges the Z-order of an Image or Text Area element in a DocX document.
DocDeleteDeletes an element from a document. This element is deleted from its associated document.
DocInsertInserts 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.
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help