Home | Sign in | English US
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Creates a Word file (.RTF) from the data found in a Table or TreeView Table control.
Note: This file can be opened by Word or by OpenOffice Writer (depending on the software installed on the current computer).
Reports and Queries
sFile is string
// Asks for the file name
sFile = fSelect("", "", "Choose the export file", ...
"Word files (*.rtf) *.rtf", "rtf", fselCreate + fselExist)
// If the name was not specified, cancels the export
// Otherwise, exports the content of TABLE_TABLE1
IF sFile <> "" THEN TableToWord(TABLE_TABLE1, sFile, taNoTitle)
<Result> = TableToWord(<Table control> , <Name of Doc File> [, <Options> [, <Start Row> [, <End Row>]]])
<Result>: Boolean
  • True if the file was created,
  • False otherwise.
<Table control>: Control name
Name of control to use. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
<Name of Doc File>: Character string (with quotes)
Name and full path of the Word file to create. The file is replaced by the new file if it already exists.
<Options>: Optional Integer constant
Configures the Word file to create.
taWithInvisibleColumnsAlso exports the invisible control columns.
taColumnDisplayedOrderExports the columns according to the order of columns currently displayed in the control (and not according to the order of columns defined in the editor).
taSelectedLinesExports the selected rows only (all the rows are exported by default).
taNoTitleOnly the data is copied into the file.
taNoTotalDoes not export:
  • the rows containing totals, mean and automatic count (these rows are exported by default).
(Default value)
The title of columns is inserted into the file.
<Start Row>: Optional integer
Number of the row where the export will start. If this parameter is not specified, the start row is the first row of control.
<End Row>: Optional integer
Number of the row where the export will end. If this parameter is not specified, the end row is the last row of control.
  • The created file can be opened by Word 95 (or later) or by OpenOffice Writer 2 (or later).
  • The merged columns are ignored.
Related Examples:
The TableTo functions Unit examples (WINDEV): The TableTo functions
[ + ] Exporting table data with the WLanguage functions.
The following topics are presented in this example:
1/ interfacing with Word and Excel
2/ sending data to the clipboard
3/ generating a text file
This example explains how to export the content of a table to a Word document, an Excel workbook, the clipboard or a text file via the following WLanguage functions: TableToWord, TableToExcel, ToClipboard, TableToText.
Business / GUI classification : GUI Code
Component : wd240std.dll
Minimum required version
  • Version 9
This page is also available for…
Click [Add] to post a comment