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 Document variables
  • WLanguage functions that use Document variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The Document type is used to handle a "docx" document. The content of this document can be viewed and modified by several WLanguage functions and properties.
A Document variable can be initialized:
  • with a ".docx" file or an ".rtf" file.
  • with a buffer (containing a docx or rtf).
  • with a Binary Memo item of a data file.
  • with a character string. For example:
    MonDoc is Document = "un paragraphe." + RC + "un second paragraphe."
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
// Chargement du document
MonDoc is Document = "c:\temp\doc.docx"
// Parcours des paragraphes du document
FOR EACH para OF MonDoc.Paragraph
	FOR EACH MonElément OF para.Element
		Trace(MonElément.Texte)
	END
END
Properties

Properties specific to Document variables

The following properties can be used to handle Document variables:
Property nameType usedEffect
Bookmark[Bookmark name]Associative array of DocFragment variablesFragment associated with the bookmark.
EvenOddPageDifferentBoolean
  • True if the document must have different headers and footers for the even and odd pages,
  • False otherwise. In this case, the headers and footers are identical for the even and odd pages.
FilePathCharacter stringName and full path of docx file associated with the document.
This property is read-only. It is assigned when using DocOpen.

Remarks:
  • When assigning a Document variable into another one, this property is not copied (except during the call to DocOpen).
  • If the document comes from a buffer, this property is set to an empty string ("").
ModifiedBoolean
  • True if the document was modified since its opening (through programming or by the user),
  • False otherwise.
This property is read-only.
NumberingArray of docNumberingNumberings associated with the document. The document numberings can be browsed via the FOR EACH statement.
PageColorColor variableBackground color of the page.
ParagraphArray of docParagraphParagraphs included in the document body. The document paragraphs can be browsed via the FOR EACH statement.
PasswordCharacter stringPassword for the docx file. This password is used to encrypt the docx file. This password will be requested when opening the docx file.
PropertydocProperty variableDocument properties.
ReadOnlyBoolean
  • True if the document is read-only,
  • False otherwise.
This property is read-only.
SectiondocSection variableSection information (information global to the document).
StyleArray of docStyle variablesInformation about the styles linked to the document (information global to the document).
Remarks

WLanguage functions that use Document variables

Document variables can be handled using the following WLanguage functions:
  • 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, a text or an image.
    DocCloseCloses a docx file and frees the document.
    DocEndModificationSignals the end of the grouping of a set of operations into a single event (undo/redo management).
    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.
    DocOpenOpens a Word Processing file (docx format) in Read/Write mode. The docx file is opened and locked until it is closed.
    DocPrintPrints a document in "docx" format.
    DocRedoRestores the last undone action on a Word Processing document.
    DocRedoCountReturns the number of canceled actions that can be redone on a Word Processing document.
    DocReplaceFinds all the instances of a character string and replaces them with another string:
    • in an entire Word Processing document.
    • in a fragment.
    DocSaveSaves a document as a "docx" file.
    DocStartModificationSignals the start of the grouping of a set of operations on a document into a single event (undo/redo management).
    DocToHTMLConverts a Word Processing document into an HTML file.
    DocToImageExports a page found in a Word Processing document in image format.
    DocToPDFConverts a Word Processing document into a PDF file.
    DocToTextCreates a character string from the data:
    • found in a Word Processing control or in a Word Processing document.
    • found in a paragraph of a Word Processing control.
    DocUndoUndoes the last action performed on a Word Processing document.
    DocUndoCountReturns the number of actions that can be undone on a document.
    DocUndoRedoDeleteAllDeletes the entire history of Undo/Redo mechanism for a Word Processing document.
    iPrintDocPrints a document in "docx" format.
  • prefix syntax:
    <Document variable>.AddAdds an element, document, paragraph, text, image or fragment to the end of a Document variable..
    <Document variable>.CloseCloses the docx file associated with the Document variable and frees the document.
    <Document variable>.EndModificationIndicates the end of a series of actions performed in a Document variable in a single event ("undo/redo").
    <Document variable>.InsertInserts an object in a Document variable. The objects that can be used are:
    • an element,
    • a document,
    • a paragraph,
    • a text,
    • an image,
    • a fragment.
    <Document variable>.InsertTableInserts a table in a Document variable.
    <Document variable>.PrintPrints the content of a Document in "docx" format.
    <Document variable>.RedoRestores the last action canceled on a Document variable.
    <Document variable>.ReplaceFinds all the instances of a character string and replaces them with another string in a Document variable.
    <Document variable>.SaveSaves a document as a "docx" file.
    <Document variable>.SeekFinds a character string in an entire Document variable.
    <Document variable>.StartModificationIndicates the start of a series of actions performed on a Document variable in a single event ("undo/redo").
    <Document variable>.ToHTMLConverts a Document variable into an HTML file.
    <Document variable>.ToImageExports a page contained in a Document variable in image format.
    <Document variable>.ToTextCreates a character string with the data of a Document variable.
    <Document variable>.UndoUndoes the last action performed on a Document variable.
    <Document variable>.UndoCountReturns the number of actions that can be undone in a Document variable.
    <Document variable>.UndoRedoDeleteAllDeletes the entire history of Undo/Redo mechanism for a Word Processing document.
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/20/2024

Send a report | Local help