PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of docFragment variables
  • Functions that use the docFragment variables
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
The docFragment type is used to define the characteristics of a fragment found in a "docx" document. The characteristics of this fragment can be defined and modified by several 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: See Declaring a variable for more details.
Example
// Change the selection color
// Get the current selection
MySelection is docFragment(WP_MyDocument, WP_MyDocument..Cursor, ...
WP_MyDocument..SelectionLength)
// Change the color
MySelection..Style..TextColor = PastelRed
// Change the selection color
// Get the current selection
MySelection is docFragment(WP_MyDocument, WP_MyDocument..Cursor, ...
WP_MyDocument..SelectionLength)
// Change the color
MySelection..Formatting..TextColor = PastelRed
// Load the document
MyDoc is Document = "c:\temp\doc.docx"

// Adds text at the end of document
FragmentEnd is docFragment(MyDoc, -1 , 0)
FragmentEnd..Text += "End of 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 (DocSeek 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 (with or without quotes)
Document from which a fragment will be extracted. This document corresponds to:
  • WINDEV the name of a Word Processing control.
  • a Document variable.
<Start of Fragment>: Optional integer
Start position of 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.
Remarks

Properties specific to the description of docFragment variables

The following properties can be used to handle a docFragment variable:
Property nameType usedEffect
ElementArray of docElementElements making up the document fragment used. The fragment elements can be browsed via the FOR EACH statement.
WordArray of docFragmentWords making up the document fragment used. The fragment words can be browsed via the FOR EACH statement.
ParagraphArray of docParagraphParagraphs affected by the fragment (if a fragment includes several paragraphs). The paragraphs can be browsed via the FOR EACH statement.
StartPositionIntegerStart position of fragment. This position is relative to the entire document.
EndPositionIntegerEnd position of fragment. This position is relative to the entire document.
StyleInformation of combined styles for all elements making up the document fragment used.
Style..VerticalAlignInteger constantText position on the baseline:
  • alignBaseline: The text is positioned on the base line.
  • alignSuperscript: The text is positioned in superscript.
  • alignSubscript: The text is positioned in subscript.
Style..UnderlineColorIntegerColor used to underline the text. This color corresponds to:
  • an RGB color (returned by RGB).
  • an HSL color (returned by HSL),
  • a preset color of WLanguage.
Style..HighlightColorIntegerColor used to highlight the text. Only the following colors are available:
  • Transparent
  • Black
  • LightBlue
  • LightCyan
  • LightGreen
  • LightMagenta
  • LightRed
  • LightYellow
  • White
  • DarkBlue
  • DarkCyan
  • DarkGreen
  • DarklMagenta
  • DarkRed
  • DarkYellow
  • LightGray
  • DarkGray
Style..TextColorIntegerText color. This color corresponds to:
  • an RGB color (returned by RGB).
  • an HSL color (returned by HSL),
  • a preset color of WLanguage.
Style..FontStrikeOutInteger
  • 0: Font not struck
  • 1: Font struck
  • 2: Undefined
Style..FontBoldInteger
  • 0: Non-bold font
  • 1: Bold font
  • 2: Undefined
Style..FontItalicInteger
  • 0: Non-italic font
  • 1: Italic font
  • 2: Undefined
Style..FontNameCharacter stringModify the font used for the fragment.
Style..FontUnderlinedInteger constantType of underline:
  • underlineNone: No underline
  • underlineDouble: Double underline
  • underlineThick: Thick underline
  • underlineWords: Underline words only
  • underlineDotted: Underline in dots
  • underlineDottedHeavy: Underline in heavy dots
  • underlineDotDotDash: Underline with dots and dashes
  • underlineDotDotDashHeavy: Underline with heavy dots and dashes
  • underlineDotDash: Underline with dashes
  • underlineDotDashHeavy: Underline with heavy dashes
  • underlineSingle: Single underline
  • underlineDash: Underline with dashes
  • underlineDashHeavy: Underline with heavy dashes
Style..FontSizeRealFont size.
TextCharacter stringRough text corresponding to the content of fragment used.
Property nameType usedEffect
ElementArray of docElementElements making up the document fragment used. The fragment elements can be browsed via the FOR EACH statement.
SubDocumentIdentifierIntegerIdentifier corresponding to the sub-document associated with the fragment. This property is intended for an advanced use.
Caution: This property is available from version 220071.
LanguageSpellingCharacter stringLanguage 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.
Note: To perform the spell check corresponding to the fragment language, the dictionary of this language must be loaded by DictionaryLoad.
This property is available from version 220059U (module dated 05/17/2017).
FormattingdocFormatting variableFormatting information for all the elements making up the document fragment used.
PageLayoutLayout of current fragment.
Caution: This property is available from version 220071.
PageLayout..BrushColorIntegerBackground color of fragment. This color can correspond to:
PageLayout..BackgroundFrameBackground variableCharacteristics of fragment background.
WordArray of docFragmentWords making up the document fragment used. The fragment words can be browsed via the FOR EACH statement.
ParagraphArray of docParagraphParagraphs affected by the fragment (if a fragment includes several paragraphs). The paragraphs can be browsed via the FOR EACH statement.
StartPositionIntegerStart position of fragment. This position is relative to the entire document.
EndPositionIntegerEnd position of fragment. This position is relative to the entire document.
StyleIDCharacter stringIdentifier of style applied to the fragment. This identifier must exist among the styles linked to the document.
Note: the change of paragraph or fragment style automatically applies the linked paragraph style and character style if they exist.
TextCharacter stringRough text corresponding to the content of fragment used.
TypeSubDocumentInteger constantSection of document to which the fragment belongs.
Caution: This property is available from version 220071.
The possible values are as follows:
  • Versions 23 and later
    typeSubDocCanvas: Image container
    New in version 23
    typeSubDocCanvas: Image container
    typeSubDocCanvas: Image container
  • typeSubDocBody: Document body.
  • typeSubDocHeaderOddPage: Header of odd page.
  • typeSubDocHeaderEvenPage: Header of even page.
  • typeSubDocHeaderFirstPage: Header of first page.
  • typeSubDocFooterOddPage: Footer of odd page.
  • typeSubDocFooterEvenPage: Footer of even page.
  • typeSubDocFooterFirstPage: Footer of first page.
  • Versions 23 and later
    typeSubDocTextArea: Text area.
    New in version 23
    typeSubDocTextArea: Text area.
    typeSubDocTextArea: Text area.
This property is available in read-only.

Note: These properties can be handled by using one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Functions that use the docFragment variables

Versions 22 and later
DocAdd
New in version 22
DocAdd
DocAdd
Adds at the end of a Word Processing document:
  • an element,
  • a document,
  • a paragraph,
  • a text,
  • an image,
  • a fragment.
Versions 22 and later
DocInsert
New in version 22
DocInsert
DocInsert
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.
Versions 22 and later
DocInsertTable
New in version 22
DocInsertTable
DocInsertTable
Inserts a table into a Word Processing document.
Versions 22 and later
DocSeek
New in version 22
DocSeek
DocSeek
Seeks a character string in a Word Processing document.
Versions 22 and later
DocSelect
New in version 22
DocSelect
DocSelect
Selects a fragment in a Word Processing control.
Minimum required version
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment