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 / Funciones estándar / Funciones de archivos XLS
  • Properties specific to xlsDocument variables
  • Accessing a column of an Excel document
  • Accessing a cell of an Excel document
  • Accessing a cell of a column in an Excel document
  • Accessing a cell of a row in an Excel document
  • WLanguage functions that use xlsDocument variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
An xlsDocument variable is used to describe and modify an Excel document.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
MaFeuille is xlsDocument
NomFichierXLS is string
NomFichierXLS = fSelect(fExeDir(), "", "Sélectionnez un fichier...", ...
"Tous fichiers (*.*)" + TAB + "*.*", "*", fselOpen + fselExist)
IF NomFichierXLS = "" THEN RETURN
MaFeuille = xlsOpen(NomFichierXLS, xlsWrite)

// On va mettre OK dans la case A 25
MaFeuille[25,"A"] = "OK"
// Sauvegarde
xlsSave(MaFeuille)
IDFicXLS is xlsDocument 
NomFichierXLS is string = fExeDir + "\Suivi d'affaires1.xls"

IDFicXLS = xlsOpen(NomFichierXLS, xlsWrite)
IF ErrorOccurred = False THEN
Azz is int = xlsCurrentWorksheet(IDFicXLS)
Info("Feuille en cours dans le fichier Excel: " + Azz)
// Changement de feuille
IF xlsCurrentWorksheet(IDFicXLS, 2) = True THEN
Info("La feuille courante a été modifiée.")
// Lecture d'une cellule pour test
Info(xlsData(IDFicXLS, 11, 2))
ELSE
Error("Le fichier sélectionné ne comporte pas de seconde feuille!")
END 
ELSE
Error("Attention! le fichier est déjà ouvert sur un poste de travail!")
END
Novedad versión 2024
// Créer un document de type xls
xlsDoc is xlsDocument(xlsVersionXls)
Sintaxis

Declaring an Document XLS without specifying the format Ocultar los detalles

MyVariable is an xlsDocument
In this case, the Variable created does not correspond to a specific Excel format.. The format will be defined when the file is Record'd (according to the extension specified)..
Novedad versión 2024

Declare an Document XLS by specifying the format Ocultar los detalles

MyVariable is a xlsDocument (<Format> )
<Format>: Integer constant
Document format handled. This parameter can correspond to the following constants:
xlsVersionUndefinedVersion not defined (value by Default). The format will be defined when the file is Record..
xlsVersionXlsDocument type Xls.
xlsVersionXlsxDocument type Xlsx.
Observaciones

Properties specific to xlsDocument variables

The following properties can be used to handle xlsDocument variables:
nomType usedEffect
CellArray of xlsCellCells in the XLS document.
ColumnArray of xlsColumnColumn in the XLS document.
FileCharacter stringName and full path of XLS file associated with the document. This property is read-only. It is assigned when using xlsOpen.
Remark: when assigning an xlsDocument variable into another one, this property is not copied (except during the call to xlsOpen).
ModifiedBoolean
  • True if the document was modified
  • False otherwise.
This property is reset to False after the call to xlsSave.
NumberColumnentierNumber of columns found in the document (identical to xlsNbColumn). This property is read-only.
NumberRowentierNumber of rows found in the document (identical to xlsNbRow). This property is read-only.
NumberWorksheetentierNumber of worksheets found in the document (identical to xlsNbWorksheet). This property is read-only.
RecalculateWhenLoadingBoolean
  • True if the formulas of the document must be recalculated when the document is opened in Excel or OpenOffice.
  • False if no calculation must be performed when the document is opened in Excel or OpenOffice.
Remark: Only the formulas initially found in the document can be recalculated.
RightToLeftBoolean
  • True if the mode for reading the current worksheet is "Right to left".
  • False if the mode for reading the current worksheet is "Left to right".
RowArray of xlsRowRow in the XLS document.
SheetentierNumber of the current worksheet (identical to xlsCurrentWorksheet).
SheetNameCharacter stringName of the current worksheet. This property can correspond to a string containing between 1 and 31 characters. It is case insensitive.
VersionentierXLS document version (same as xlsVersion). This property is read-only.

Accessing a column of an Excel document

The following syntaxes can be used to access a column of an Excel document:
  • MyXLSDocument.Column[1]: Accesses the column 1 of the Excel file.
  • MyXLSDocument.Column["A"]: Accesses the column A of the Excel file.

Accessing a cell of an Excel document

The following syntaxes can be used to access a cell of an Excel document:
  • MyXLSDocument[1,2]: Accesses the cell found in row 1 and column 2 of the Excel file.
  • MyXLSDocument[5, "A"]: Accesses the cell found in row 5 and column A of the Excel file.

Accessing a cell of a column in an Excel document

The following syntaxes can be used to access a cell of a column in an Excel document:
  • MyXLSDocument.Column[1].Cell: Returns the value of the cell found in column 1 for the current row.
  • MyXLSDocument.Column["A"].Cell: Returns the value of the cell found in column "A" for the current row.

Accessing a cell of a row in an Excel document

The following syntax can be used to access a cell of a row in an Excel document:
  • MyXLSDocument.Row[1].Cell[2]: Accesses the cell found in row 1 and column 2 of the Excel file.
  • MyXLSDocument.Row[5].Cell["A"]: Accesses the cell found in row 5 and column A of the Excel file.

WLanguage functions that use xlsDocument variables

  • Standard syntax:
    xlsAddWorksheetAñade o inserta una nueva hoja de trabajo en un Excel Document.
    xlsCerrarCierra un archivo XLS.
    xlsColumnTitleRetrieves the title of a column found in an XLS file.
    xlsColumnTypeDevuelve el tipo de datos introducidos en una columna de un fichero XLS.
    xlsCurrentWorksheetSe utiliza para averiguar y modificar la hoja de trabajo actual en un archivo XLS.
    xlsDataRecupera el contenido de una celda encontrada en un archivo XLS.
    xlsDeleteWorksheetBorra una hoja de trabajo del Excel Document.
    xlsGetMergeDetermina si una celda está combinada con otras y obtiene el rango de celdas combinadas.
    xlsMergeCellCombina las celdas especificadas en un documento Excel.
    xlsMsgErrorReturns the caption of the last error caused by an XLS function.
    xlsNbColumnReturns the number of columns found in a worksheet of an XLS file.
    xlsNbColumnsxlsNbColumns se mantiene sólo para la compatibilidad con versiones anteriores.
    xlsNbHoja de trabajoDevuelve el número de hojas de trabajo que se encuentran en un archivo XLS.
    xlsNbRowDevuelve el número de líneas que se encuentran en un archivo XLS.
    xlsNbRowsxlsNbRows se mantiene sólo para compatibilidad con versiones anteriores.
    xlsOpenAbre un archivo de Excel (archivos xls o xlsx).
    xlsRecalculateAllRecalcula todas las fórmulas de un documento Excel (XLSX).
    xlsSaveGuarda un XLS Document.
    xlsUnmergeCellAnula la combinación de un rango de celdas.
    xlsVersionDevuelve la versión de Excel que se utilizó para grabar el fichero.
Versión mínima requerida
  • Versión 14
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 05/01/2024

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