PC SOFT

AYUDA EN LÍNEA
DE WINDEV, WEBDEV Y WINDEV MOBILE


  • Use conditions
  • Various
  • Printing in an XLS file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Otros
Procedimientos almacenados
TableToExcel (Function)
 
Creates an Excel file from the data found in a Table or TreeView Table control .
Note: This file can be opened by Excel or by OpenOffice Calc (depending on the software installed on the current computer).
Versiones 16 y posteriores
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Nueva funcionalidad versión 16
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Versiones 18 y posteriores
WEBDEV - Código Servidor This function can now be used to handle the treeview tables in the WEBDEV sites.
Nueva funcionalidad versión 18
WEBDEV - Código Servidor This function can now be used to handle the treeview tables in the WEBDEV sites.
WEBDEV - Código Servidor This function can now be used to handle the treeview tables in the WEBDEV sites.
Versiones 23 y posteriores
WEBDEV - Código ServidorLinux This function is now available for WEBDEV sites in Linux.
Nueva funcionalidad versión 23
WEBDEV - Código ServidorLinux This function is now available for WEBDEV sites in Linux.
WEBDEV - Código ServidorLinux This function is now available for WEBDEV sites in Linux.
Ejemplo
WINDEVReportes y ConsultasCódigo de Usuario (UMC)
sFile is string
// Asks for the file name
sFile = fSelect("", "", "Choose the export file", ...
"Excel files (*.xls) *.xls", "xls", 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)
Sintaxis

Selecting all rows or the first N rows found in the Table or TreeView Table control Ocultar los detalles

<Result> = TableToExcel(<Table control> , <Name of XLS file> [, <Options> [, <Number of Exported Rows>]])
<Result>: Boolean
  • True if the file was created,
  • False otherwise. To find out the error details, use ErrorInfo.
<Table control>: Control name
Name of control to use. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
<Name of XLS file>: Character string (with quotes)
Name and full path of Excel file to create. The file is replaced by the new file if it already exists.
<Options>: Optional Integer constant
Configures the XLS file to create.
taWithInvisibleColumnsAlso exports the invisible control columns.
Versiones 22 y posteriores
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • by programming: ..VisibleInExportAndPrint set to False.
  • in the "General" tab of the description window of columns: "Export and print" to "Never".
Nueva funcionalidad versión 22
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • by programming: ..VisibleInExportAndPrint set to False.
  • in the "General" tab of the description window of columns: "Export and print" to "Never".
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • by programming: ..VisibleInExportAndPrint set to False.
  • in the "General" tab of the description window of columns: "Export and print" to "Never".
taWithLayoutExports the color and the font used in the control.
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).
WEBDEV - Código Servidor This constant is not available.
taMergeIf 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.
taSelectedLinesExports the selected rows only (all the rows are exported by default). Does not export the totals.
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).
  • Versiones 22 y posteriores
    WINDEV the rows containing custom calculations (these rows are exported by default).
    Nueva funcionalidad versión 22
    WINDEV the rows containing custom calculations (these rows are exported by default).
    WINDEV the rows containing custom calculations (these rows are exported by default).
WEBDEV - Código Servidor This constant is not available.
taColumnsTitles
(default value)
The title of columns is inserted into the file.
<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 Ocultar los detalles

<Result> = TableToExcel(<Table control> , <Name of XLS file> [, <Options> [, <Start row> [, <End row>]]])
<Result>: Boolean
  • True if the file was created,
  • False otherwise. To find out the error details, use ErrorInfo.
<Table control>: Control name
Name of control to use. This control can correspond to:
  • a Table control.
  • a TreeView Table control.
<Name of XLS file>: Character string (with quotes)
Name and full path of Excel file to create. The file is replaced by the new file if it already exists.
<Options>: Optional Integer constant
Configuration of XLS file to create.
taWithInvisibleColumnsAlso exports the invisible control columns.
Versiones 22 y posteriores
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • by programming: ..VisibleInExportAndPrint set to False.
  • in the "General" tab of the description window of columns: "Export and print" to "Never".
Nueva funcionalidad versión 22
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • by programming: ..VisibleInExportAndPrint set to False.
  • in the "General" tab of the description window of columns: "Export and print" to "Never".
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • by programming: ..VisibleInExportAndPrint set to False.
  • in the "General" tab of the description window of columns: "Export and print" to "Never".
taWithLayoutExports the color and the font used in the control.
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).
WEBDEV - Código Servidor This constant is not available.
taMergeIf the XLS file already exists, merges the existing content with the new content: the formulas, the formatting, ... of existing cells is kept.
taSelectedLinesExports the selected rows only (all the rows are exported by default).
Does not export the totals.
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).
  • Versiones 22 y posteriores
    WINDEV the rows containing custom calculations (these rows are exported by default).
    Nueva funcionalidad versión 22
    WINDEV the rows containing custom calculations (these rows are exported by default).
    WINDEV the rows containing custom calculations (these rows are exported by default).
WEBDEV - Código Servidor This constant is not available.
<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.
Observaciones

Use conditions

TableToExcel can be used on:
  • a browsing or memory control.
  • a single-selection or multiselection control.

Various

  • 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).
  • The "High-Precision Numeric" columns (38 significant digits) will be exported as exponential numbers.
  • The merge operation performed on the Table control columns is ignored.
  • The columns in Unicode format are exported in Unicode format into Excel.
  • The Check Box columns are exported as check boxes.
  • The following elements are not exported into the Excel file:
    • The images,
    • The charts,
    • The bar codes.

Printing in an XLS file

A print can be directly performed in an XLS file by iPreview or iDestination or from the print preview. The created XLS file is configured by iParameterXLS.
Clasificación Lógica de negocio / GUI : Código GUI
Componente : wd250xls.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Video TableToExcel
https://youtu.be/Eajy0iH2HaE

https://windevdesenvolvimento.blogspot.com/2019/02/dicas-2016-windev-tabela-92-tabletoexcel.html


TableToExcel(TABLE_WIN_TABELA_EXEMPLO,"EXEMPLO.XLS",taColumnsTitles)
amarildo
14 02 2019
Exemplo Ler Tabela e Exportar Excel
s_path is string=CompleteDir(fExeDir())
// s_path=ComplèteRep(fRepExe()) // Em frances
TableToExcel(TABLE_pedido,s_path+"nome_excel.xls")
//TableVersExcel(TABLE_pedido,s_path+"nome_excel.xls") // em frances
ShellExecute(s_path+"nome_excel.xls")

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/02/curso-windev-excel-002-ler-tabela-e.html
De matos AMARILDO
02 02 2016