AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones Procesador de texto / Tipos de variables
  • Properties specific to docFragment variables
  • WLanguage functions that use docFragment variables
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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.
Ejemplo
// 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"
Sintaxis

Declaring a document fragment that is not described Ocultar los detalles

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 Ocultar los detalles

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:
  • WINDEV 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.
Propiedades

Properties specific to docFragment variables

The following properties can be used to define the characteristics of docFragment variables:
Property nameType usedEffect
ElementArray of docElementElements making up the document fragment used. The fragment elements can be browsed via the FOR EACH statement.
RangeIntegerNumber 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.
SubDocumentIdentifierIntegerIdentifier corresponding to the subdocument associated with the fragment. This property is intended for an advanced use.
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.
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.
FormattingdocFormatting variableFormatting information for all the elements making up the document fragment used.
PageLayoutLayout of current fragment.
PageLayout.BackgroundColorIntegerBackground color of fragment. This color can correspond to:
PageLayout.BackgroundPatternBackground 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: changing the style of a paragraph or fragment automatically applies the linked paragraph style and character style, if any.
TextCharacter stringRough text corresponding to the content of fragment used.
TypeSubDocumentInteger constantSection of document to which the fragment belongs. The possible values are:
  • typeSousDocCanvas Image container.
  • typeSousDocCorps Document body.
  • typeOddPageHeaderSubDoc Odd page header.
  • typeSousDocEnTêtePagePaire Even page header.
  • typeSubDocEnTêtePremièrePage First page header.
  • typeOddFooterSubDoc Odd footer.
  • typeEvenPageFooterSubDoc Even footer.
  • typeFirstPageFooterSubDoc First page footer.
  • typeSousDocTextZone Text area.
This property is read-only.
Observaciones

WLanguage functions that use docFragment variables

docFragment variables are handled by several WLanguage functions:
  • WLanguage functions that use standard syntax:
    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.
    DocFindFinds a character string:
    • in an entire Word Processing document.
    • in a fragment.
    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.
    DocInsertTableInserts a table into a Word Processing document.
    DocSelectSelects a fragment in a Word Processing control.
  • WLanguage functions that use prefix syntax:
    <docFragment variable>.addAñade un elemento, texto o imagen al final de una variable docFragment.
    <docFragment variable>.InsertSustituye el contenido del fragmento actual. Los objetos que se pueden utilizar son:
    • un elemento,
    • un documento,
    • a paragraph,
    • un texto,
    • una imagen, etc,
    • un fragmento.
    <docFragment variable>.InsertTableSustituye el fragmento especificado por una tabla.
Versión mínima requerida
  • Versión 22
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local