|
|
|
|
|
- Properties specific to docFragment variables
- WLanguage functions that use docFragment variables
docFragment (Variable type) In french: docFragment
The docFragment type is used to define the characteristics of a fragment found in a "docx" document. You can define and change the characteristics of this fragment using different WLanguage properties. A fragment is defined by its start and end positions. Therefore, it can: - extend on several paragraphs,
- start in the middle of any ordinary word,
- end in the middle of any ordinary word.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
MaSélection is docFragment(TT_MonDocument, TT_MonDocument.Curseur, ...
TT_MonDocument.LongueurSélection)
MaSélection.MiseEnForme.CouleurTexte = PastelRed
MonDoc is Document = "c:\temp\doc.docx"
FragmentFin is docFragment(MonDoc, -1 , 0)
FragmentFin.Text += "Fin de document"
Syntax
Declaring a document fragment that is not described Hide the details
MyVariable is docFragment
In this case, the document fragment is not described. The variable will have to be assigned with an existing fragment or with the result of one of the functions for handling documents ( DocFind for example).
Declaring and describing a fragment Hide the details
MyVariable is docFragment([<Document> [, <Start of fragment> [, <Length>]]])
<Document>: Optional Document variable or character string Document from which a fragment will be extracted. This document corresponds to: - the name of a Word Processing control.
- a variable of type Document.
<Start of fragment>: Optional integer Start position of the document fragment to use. This position is given in number of characters: - from the start of document (positive number).
- from the end of document (negative number).
<Length>: Optional integer Length of fragment to use, expressed in number of characters. Note: a negative number is used to take a number of characters from the end: '-1' = to the end, '-2' = to 1 character before the end, etc. Properties Properties specific to docFragment variables The following properties can be used to handle docFragment variables:
| | | | Property name | Type used | Effect |
---|
Element | Array of docElement | Elements making up the document fragment used. The fragment elements can be browsed via the FOR EACH statement. | Range | Integer | Number of characters in the fragment. Corresponds to the end position minus the start position. The extent can correspond to a positive, negative or zero value. Remarks: - If the fragment contains a table or a section of a table, all characters in it are counted..
- If the fragment contains an image or a text area, each one corresponds to 1 character.
| SubDocumentIdentifier | Integer | Identifier corresponding to the subdocument associated with the fragment. This property is intended for an advanced use. | LanguageSpelling | Character string | Language of fragment. The notation used corresponds to the 639-1 standard. For example "FR-fr". In read mode, this property returns a valid information only if the fragment corresponds to a single language. Remark: To perform the spelling correction corresponding to the language of the fragment, it is necessary to load the dictionary for this language with function DictionaryLoad. | Formatting | docFormatting variable | Formatting information for all the elements making up the document fragment used. | PageLayout | | Layout of current fragment. | | PageLayout.BackgroundColor | Integer | Background color of fragment. This color can correspond to: | | PageLayout.BackgroundPattern | Background variable | Characteristics of fragment background. | Word | Array of docFragment | Words making up the document fragment used. The fragment words can be browsed via the FOR EACH statement. | Paragraph | Array of docParagraph | Paragraphs affected by the fragment (if a fragment includes several paragraphs). The paragraphs can be browsed via the FOR EACH statement. | StartPosition | Integer | Start position of fragment. This position is relative to the entire document. | EndPosition | Integer | End position of fragment. This position is relative to the entire document. | StyleID | Character string | Identifier of style applied to the fragment. This identifier must exist among the styles linked to the document. Note: changing the style of a paragraph or fragment automatically applies the linked paragraph style and character style if they exist. | Text | Character string | Rough text corresponding to the content of fragment used. | TypeSubDocument | Integer constant | Section of document to which the fragment belongs.
The possible values are: - typeSousDocCanvas: Image container.
- typeSousDocCorps: Document body.
- typeSousDocEnTêtePageImpaire: Odd page header.
- typeSousDocEnTêtePagePaire: Even page header.
- typeSousDocEnTêtePremièrePage: Header for the first page.
- typeOddFooter: Odd footer.
- typeSousDocPiedPageFooter: Even page footer.
- typeFirstPageFooter: First page footer.
- typeSousDocZoneDeTexte: Text area.
This property is read-only. |
Remarks WLanguage functions that use docFragment variables docFragment variables are handled by several WLanguage functions: - WLanguage functions that use standard syntax:
| | DocAdd | Adds: - 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.
| DocFind | Finds a character string: - in an entire Word Processing document.
- in a fragment.
| DocInsert | 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.
| DocInsertTable | Inserts a table into a Word Processing document. | DocSelect | Selects a fragment in a Word Processing control. |
- WLanguage functions that use prefix syntax:
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|