|
|
|
|
|
- Use conditions
- Miscellaneous
- Printing in an XLS file
TableToExcel (Function) In french: TableVersExcel Creates an Excel file with the data from a Table or TreeView Table control. Remark: This file can be opened by Excel or by OpenOffice Calc (depending on the software installed on the current computer).
Syntax
Selecting all rows or the first N rows found in the Table or TreeView Table control Hide the details
<Result> = TableToExcel(<Table control> , <XLS file to create> [, <Options> [, <Number of exported rows>]])
<Result>: Boolean - True if the file was created,
- False otherwise. To get more details on the error, use ErrorInfo.
<Table control>: Control name Name of the control to be used. This control can correspond to: - a Table control.
- a TreeView Table control.
<XLS file to create>: Character strings Name and full path of Excel file to create. The file is replaced with the new file if it already exists. <Options>: Optional Integer constant or combination of constants Configures the XLS file to create. | | taColumnDisplayedOrder | Exports 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).
| taColumnsTitles (default value) | The title of the columns is inserted in the file. | taMerge | If the XLS file already exists, merges the existing content with the new content: the formulas, the formatting, ... of existing cells is kept. The existing data is not stored. Only the data of columns and rows found as well in the existing XLS file is kept. | taNoTitle | Only the data is copied to the file. | taNoTotal | Does not export: - the rows containing totals, mean and automatic count (these rows are exported by default).
- the rows containing custom calculations (these rows are exported by default).
| taSelectedLines | Exports the selected rows only (all the rows are exported by default). Does not export the totals. | taWithInvisibleColumns | Also exports the invisible control columns. | taWithLayout | Exports the color and the font used in the control. |
<Number of exported rows>: Optional integer Number of rows to export. Only the rows found between 1 and <Number of exported rows> will be exported.All rows found in the Table control will be exported if this parameter is not specified.
Selecting the rows found in the Table or TreeView Table control Hide the details
<Result> = TableToExcel(<Table control> , <XLS file to create> [, <Options> [, <Start row> [, <End row> [, <Password>]]]])
<Result>: Boolean - True if the file was created,
- False otherwise. To get more details on the error, use ErrorInfo.
<Table control>: Control name Name of the control to be used. This control can correspond to: - a Table control.
- a TreeView Table control.
<XLS file to create>: Character strings Name and full path of Excel file to create. The file is replaced with the new file if it already exists. <Options>: Optional Integer constant or combination of constants Configuration of XLS file to create. | | taColumnDisplayedOrder | Exports 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).
| taMerge | If the XLS file already exists, merges the existing content with the new content: the formulas, the formatting, ... of existing cells is kept. | taNoTitle | Only the data is copied to the file. | taNoTotal | Does not export: - the rows containing totals, mean and automatic count (these rows are exported by default).
- the rows containing custom calculations (these rows are exported by default).
| taSelectedLines | Exports the selected rows only (all the rows are exported by default). Does not export the totals. | taWithInvisibleColumns | Also exports the invisible control columns.
| taWithLayout | Exports the color and the font used in the control. |
<Start row>: Optional integer Number of the row where the export will start. All the control rows will be exported if this parameter and <End row> are not specified. <End row>: Optional integer Number of the row where the export will end. All the control rows will be exported if this parameter and <Start row> are not specified. <Password>: Optional character string Password of the generated Excel file (only for XLSX files). This password is required to open the generated Excel file. Remarks Use conditions TableToExcel can be used on: - Table or TreeView Table controls based on a data file.
- Table or TreeView Table controls populated programmatically.
- single-selection or multi-selection controls.
Miscellaneous - The Excel files cannot exceed 65536 rows and 256 columns if the extension used is ".xls". This limit can be exceeded by using the ".xlsx" extension in order to create files in Excel 2007 format. Caution: in this case, the former versions of Excel must be equipped with the "Office 2007 compatibility pack", that can be downloaded from the Microsoft site in order to open the generated documents.
- The created file can be opened by Excel 97 (or later) or by OpenOffice Calc 2 (or later).
- It is possible to create XLSX files: You just need to specify the extension in the <XLS file to create> parameter.
- "High-Precision Numeric" columns (38 significant digits) will be exported as exponential numbers.
- The merge operation performed on the Table control columns is ignored.
- Unicode columns are exported in Unicode format to Excel.
- Check Box columns are exported as Check Boxes.
- RTF columns are exported without formatting.
- The following elements are not exported into the Excel file:
- The images,
- The charts,
- The bar codes.
Printing in an XLS file It is possible to print directly in an XLS file: The created XLS file is configured by iParameterXLS.
Related Examples:
|
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 / UI classification: UI Code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|