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
  • Using the XLS functions in read/write
  • The XLS file cannot be opened
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
Opens an Excel file. The supported formats are:
  • XLS and XLSX (Excel workbook),
  • XLSM (Excel macro-enabled workbook),
  • XLTX (Excel template),
  • XLTM (Excel macro-enabled template),
  • Novedad versión 2025
    CSV (csv file).
Note: To create an Excel file without using an initial file, simply create a variable of type xlsDocument (in this case, xlsOpen has no effect).
Linux Only the xlsx format is supported.
Novedad versión 2025
Android This function is now available for Android applications.
Widget Android This function is now available in Android widget mode.
iPhone/iPad This function is now available for iPhone/iPad applications.
doc is xlsDocument
doc = xlsOpen(fExeDir() + ["\"] + "gpac.xls")
IF ErrorOccurred() THEN
	Error(ErrorInfo())
	RETURN
END
Info("Content of [1,1] cell:", doc[1,1])
xlsClose(doc)
Sintaxis
<Result> = xlsOpen(<Path of XLS file> [, <Opening mode> [, <Password>]])
<Result>: xlsDocument variable
Name of the xlsDocument variable corresponding to the XLS file. This variable can be used by all the XLS functions. Using this type of variable allows you to modify the XLS documents.
Advertencia
Result compatible with version 12. For compatibility reasons, this variable can be converted to an integer corresponding to the specified XLS file ID. This ID can be used in all XLS functions that support the file ID. Using this syntax with an ID only allows you to read XLS documents. You will not be able to make any changes.
In the event of an error, variable ErrorOccurred is set to True and function ErrorInfo is used to find out the cause of the error.
<Path of XLS file>: Character string
Full or relative path of the file to be opened (up to 260 characters). The supported formats are:
  • XLS and XLSX (Excel workbook),
  • XLSM (Excel macro-enabled workbook),
  • XLTX (Excel template),
  • XLTM (Excel macro-enabled template),
  • Novedad versión 2025
    CSV (csv file).
<Opening mode>: Optional integer constant
Indicates the opening mode of XLS file.
By default:
  • the Excel file is opened in read-only mode. You can write to the Excel file with another application.
  • the Excel file uses the multi-sheet management mode for XLS files.
xlsCompatibleUsed to open the Excel file in mode compatible with version 10.
In this mode:
  • A single workbook sheet is supported.
  • Unicode is not supported.
  • The groups of strings are not supported.
  • Some functions (xlsData or xlsNbRow for example) may return inconsistent results.
Advertencia
A partir de la versión 11, this constant is available for backward compatibility.
xlsWriteOpens the Excel file in "Read/Write" mode. The XLS file is opened and locked until it is closed.
Note: Any changes made in the XLS file can only be taken into account if you use a variable of type xlsDocument.
<Password>: Optional string or Secret string
Password to open the XLS file to use.
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

Using the XLS functions in read/write

To handle the XLS files in read/write, you must use an xlsDocument variable. This type of variable can also be used to handle the files specific to Office 2007 (.xlsx files) in read/write.
The use of the file identifier is kept for backward compatibility with version 12. XLS documents (including ".xlsx" files specific to Office 2007) manipulated with this identifier cannot be modified (even if the constant xlsWrite is specified).
Example using the syntax kept for backward compatibility:
XLSFileID is int
XLSFileID = xlsOpen(CompleteDir(fExeDir()) + "GPACS.XLS")
IF ErrorOccurred = False THEN
		Info("The XLS file was opened")
		// Close the file 
		xlsClose(XLSFileID)
	ELSE
		Info(ErrorInfo())
	END
END

The XLS file cannot be opened

The possible error cases are as follows:
  • The specified XLS file was not found.
  • The specified XLS file does not exist.
  • The specified XLS file cannot be opened.
  • The specified XLS file is invalid.
  • Insufficient memory to open the XLS file.
  • The version of Excel used is unknown or too old (the XLS functions cannot read the files in Excel version 2 or earlier).
To get more details on the error, use xlsMsgError (if your are using version-12-compatible syntax) or ErrorInfo with the errMessage constant.
Componente: wd300xls.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 16/05/2025

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