AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones Tabla
  • Use conditions
  • Miscellaneous
  • Printing in an XLS file
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Creates an Excel file with the data from a Table or TreeView Table control.
Note This file can be opened in Excel or OpenOffice Calc (depending on the software installed on the current workstation).
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 TableToExcel(TABLE_TABLE1, sFile, taNoTitle)
WINDEVReportes y ConsultasCódigo de Usuario (UMC)
sFileName is string
...
// Generate an Excel file on the desktop
sFileID is string
sFileID = CompleteDir(SysDir(srDesktop) + fDir() + sFileName)
IF sFileID <> "" THEN
	IF TableToExcel(TABLE_Product, sFileID, aaNoTile) = False THEN
		Info(ErrorInfo())
	ELSE
		ToastDisplay("File generated")
	END
END
Sintaxis

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

<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.
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.
taColumnsTitles
(default value)
The title of the columns is inserted in the file.
taMergeIf the XLS file already exists, merge the existing content with the new content: the formulas, formatting, etc. of the existing cells are preserved. The existing data is not stored. Only the data of columns and rows found as well in the existing XLS file is kept.
taNoTitleOnly the data is copied to the file.
taNoTotalDoes not export:
  • the rows containing totals, mean and automatic count (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.
taSelectedLinesExports the selected rows only (all the rows are exported by default). Does not export the totals.
taWithInvisibleColumnsAlso exports the invisible control columns.
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • or by programming: property VisibleInExportAndPrint to False.
  • either in the "General" tab of the column description window: option "Exportar e imprimir" to "Never".
taWithLayoutExports 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 Ocultar los detalles

<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.
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, merge the existing content with the new content: the formulas, formatting, etc. of existing cells are retained.
taNoTitleOnly the data is copied to the file.
taNoTotalDoes not export:
  • the rows containing totals, mean and automatic count (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.
taSelectedLinesExports the selected rows only (all the rows are exported by default).
Does not export the totals.
taWithInvisibleColumnsAlso exports the invisible control columns.
WINDEV The columns defined as non printable and non exportable are exported. These columns are defined:
  • or by programming: property VisibleInExportAndPrint to False.
  • either in the "General" tab of the column description window: option "Exportar e imprimir" to "Never".
taWithLayoutExports 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 string or Secret string
Password of the generated Excel file (only for XLSX files). This password is required to open the generated Excel file.
Novedad versión 2025
Cadenas secretas: Si utiliza el almacén de cadenas secretas, el tipo de cadena secreta utilizado para este parámetro debe ser "ANSI o Unicode string".
Para obtener más información sobre las cadenas secretas y el almacén, consulte Almacén de cadenas secretas.
Observaciones

Use conditions

TableToExcel can be used on:
  • Data-bound Table or TreeView Table controls.
  • 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. Please note: in this case, older versions of Excel will need to be equipped with the "Office 2007 Compatibility Pack", downloadable free of charge from the Microsoft website, in order to be able 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 files in XLSX format: simply specify the extension in the <Fichier XLS à créer> 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.
Clasificación Lógica de negocio / UI: Código UI
Componente: wd300xls.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Tabla a Excel
// Se genera un archivo y se lo ubica en el escritorio y se especifica su nombre
sFileID is string = CompleteDir(SysDir(srDesktop)+fSep())+sNombreArchivo

// Check the creation of the file
IF sFileID <> "" THEN

TableToExcel(TABLE_Productos,sFileID,taNoTitle)
IF ErrorOccurred THEN
Error("No se logro Escribir el archivo")
RETURN
END

info("Archivo Generado con éxito")
ELSE

Error("No se logro Crear el nuevo archivo")
RETURN
END
Mecias SAMUEL
30 08 2022

Última modificación: 16/05/2025

Señalar un error o enviar una sugerencia | Ayuda local