PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of Document variables
  • WLanguage functions that use Document variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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:
  • WINDEV with the content of a Word Processing control.
  • 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:
    MyDoc is Document = "a paragraph." + CR + "a second paragraph."
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
// Load the document
MyDoc is Document = "c:\temp\doc.docx"
// Browse the paragraphs of the document
FOR EACH para OF MyDoc.Paragraph
FOR EACH MyElement OF para.Element
Trace(MyElement.Texte)
END
END
Remarks

Properties specific to the description of Document variables

The following properties can be used to handle a Document variable:
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 available in read-only mode. 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 corresponds 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 available in read-only mode.
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 variableProperties of document.
ReadOnlyBoolean
  • True if the document is read-only,
  • False otherwise.
This property is available in read-only mode.
SectiondocSection variableSection information (information global to the document).
StyleArray of docStyle variablesInformation about the styles linked to the document (information global to the document).

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, a document, a paragraph, a text, an image or a fragment.
    • at the end of a fragment: an element, a text or an image.
    DocStartModificationSignals the start of grouping for a set of operations on a document in a single event (management of "undo/redo").
    DocCloseCloses a docx file and frees the document.
    DocEndModificationSignals the end of grouping for a set of operations in a single event (management of "undo/redo").
    DocPrintPrints a document in "docx" format.
    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.
    DocSeekFinds a character string:
    • in an entire Word Processing document.
    • in a fragment.
    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.
    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.
    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.
    iPrintDocPrints a document in "docx" format.
  • prefix syntax:
    <Document variable>.ToTextCreates a character string with the data of a Document variable.
    <Document variable>.ToImageExports a page contained in a Document variable in image format.
    <Document variable>.ToHTMLConverts a Document variable into an HTML file.
    <Document variable>.UndoRedoDeleteAllDeletes the entire history of Undo/Redo mechanism for a Word Processing document.
    <Document variable>.UndoCountReturns the number of actions that can be undone in a Document variable.
    <Document variable>.UndoUndoes the last action performed on a Document variable.
    <Document variable>.SaveSaves a document as a "docx" file.
    <Document variable>.ReplaceFinds all the instances of a character string and replaces them with another string in a Document variable.
    <Document variable>.RedoRestores the last action canceled on a Document variable.
    <Document variable>.SeekFinds a character string in an entire Document variable.
    <Document variable>.InsertTableInserts a table in a Document variable.
    <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>.PrintPrints the content of a Document in "docx" format.
    <Document variable>.EndModificationIndicates the end of a group of operations on a Document variable in a single event ("undo/redo" management).
    <Document variable>.CloseCloses the docx file associated with the Document variable and frees the document.
    <Document variable>.StartModificationIndicates the start of a series of actions performed on a Document variable in a single event ("undo/redo").
    <Document variable>.AddAdds at the end of a Document variable: an element, a document, a paragraph, a text, an image or a fragment.
Minimum version required
  • Version 22
This page is also available for…
Comments
Click [Add] to post a comment