PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
New WINDEV, WEBDEV 24 feature!
  • Overview
  • Handling the XLS and XLSX files dynamically
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
In object syntax, WINDEV and WEBDEV allow you to handle Excel files by Handling the XLS and XLSX worksheets dynamically.
This method is using different types of variables as well as WLanguage functions. This method allows you to manage the Excel files (XLS or XLSX files) in read and write mode.
Handling the XLS and XLSX files dynamically
To handle the XLS and XLSX files, the WLanguage proposes:
  • different types of variables. These types of variables are used to handle an XLS document, an XLS row or column, an XLS cell.
  • several WLanguage functions that handle the different types of data.
To handle the XLS and XLSX files:
  1. Declare an xlsDocument variable. This type of variable is used to describe and modify an Excel document.
  2. Open (if necessary) the XLS file (xlsOpen) and associate it with the xlsDocument variable.
  3. The different elements in the Excel document can be handled:
    • with the WLanguage functions.
    • with the xlsDocument properties.
Example:
MyXLSFile is xlsDocument
AFile is string
AFile = fExeDir + "\Business info1.xls"

MyXLSFile = xlsOpen(AFile, xlsWrite)
IF ErrorOccurred = False THEN
Azz is int = MyXLSFile..Worksheet
Info("Current worksheet in the Excel file: " + Azz)
// Change worksheet
IF MyXLSFile..Worksheet = 2 THEN
Info("The current worksheet was modified.")
// Read a cell for test
Info(xlsData(XLSFileID, 11, 2))
ELSE
Error("The selected file does not include a second worksheet!")
END
ELSE
Error("Caution, the file is already opened on a computer!")
END
Notes:
  • If the Excel file is opened in read/write mode (xlsWrite constant), the file is opened and locked until it is closed. To save the modifications performed, use <xlsDocument variable>.Save.
  • The XLS functions do not require "Microsoft Excel" to be installed on the user computers.
  • The XLS files and the files specific to Office 2007 (.xlsx files) are supported.
Minimum required version
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment