PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of 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
  • Functions that use the xlsDocument variables
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
xlsDocument (Type of variable)
In French: xlsDocument (Type de variable)
An xlsDocument variable is used to describe and modify an Excel document.
Note: See Declaring a variable for more details.
Versions 16 and later
WINDEVLinux This type of variable is now available in WINDEV Linux.
WEBDEV - Server codeLinux This type of variable is now available in WEBDEV Linux.
New in version 16
WINDEVLinux This type of variable is now available in WINDEV Linux.
WEBDEV - Server codeLinux This type of variable is now available in WEBDEV Linux.
WINDEVLinux This type of variable is now available in WINDEV Linux.
WEBDEV - Server codeLinux This type of variable is now available in WEBDEV Linux.
MyWorksheet is xlsDocument
NameXLSFile is string
NameXLSFile = fSelect(fExeDir(), "", "Select a file...", ...
"All files (*.*)" + TAB + "*.*", "*", fselOpen + fselExist)
IF NameXLSFile = "" THEN RETURN
MyWorksheet = xlsOpen(NameXLSFile, xlsWrite)

// Write OK in the A25 cell
MyWorksheet[25,"A"] = "OK"
// Save
xlsSave(MyWorksheet)
XLSFileID is xlsDocument
NameXLSFile is string = fExeDir + "\Business info1.xls"

XLSFileID = xlsOpen(NameXLSFile, xlsWrite)
IF ErrorOccurred = False THEN
Azz is int = xlsCurrentWorksheet(XLSFileID)
Info("Current worksheet in the Excel file: " + Azz)
// Change worksheet
IF xlsCurrentWorksheet(XLSFileID, 2) = True 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
Remarks

Properties specific to the description of xlsDocument variables

The following properties can be used to handle an xlsDocument variable:
NameType usedEffect
CellArray of xlsCellCells in the XLS document.
ColumnArray of xlsColumnColumn in the XLS document.
Versions 17 and later
RightToLeft
New in version 17
RightToLeft
RightToLeft
Boolean
  • 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".
WorksheetIntegerNumber of the current worksheet (identical to xlsCurrentWorksheet).
FileCharacter stringName and full path of XLS file associated with the document. This property is available in read-only. It is assigned when using xlsOpen.
Note: when assigning an xlsDocument variable into another one, this property is not copied (except during the call to xlsOpen).
RowArray of xlsRowRow in the XLS document.
ModifiedBoolean
  • True if the document was modified
  • False otherwise.
This property is reset to False after the call to xlsSave.
NumberColumnIntegerNumber of columns found in the document (identical to xlsNbColumn). This property is available in read-only.
NumberWorksheetIntegerNumber of worksheets found in the document (identical to xlsNbWorksheet). This property is available in read-only.
NumberRowIntegerNumber of rows found in the document (identical to xlsNbRow). This property is available in read-only.
LeafNameCharacter stringName of current worksheet. This property can correspond to a string containing between 1 and 31 characters. It is case insensitive.
Versions 17 and later
RecalculateWhenLoading
New in version 17
RecalculateWhenLoading
RecalculateWhenLoading
Boolean
  • 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.
Note: Only the formulas initially found in the document can be recalculated.
VersionIntegerVersion of XLS document (identical to xlsVersion). This property is available in read-only.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

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.

Functions that use the xlsDocument variables

Versions 14 and later
xlsAddWorksheet
New in version 14
xlsAddWorksheet
xlsAddWorksheet
Adds or inserts a new worksheet into an Excel document.
Versions 09 and later
xlsClose
New in version 09
xlsClose
xlsClose
Closes an XLS file.
Versions 09 and later
xlsColumnTitle
New in version 09
xlsColumnTitle
xlsColumnTitle
Retrieves the title of a column found in an XLS file.
Versions 09 and later
xlsColumnType
New in version 09
xlsColumnType
xlsColumnType
Returns the type of data entered in a column of an XLS file.
Versions 11 and later
xlsCurrentWorksheet
New in version 11
xlsCurrentWorksheet
xlsCurrentWorksheet
Used to find out and modify the current worksheet in an XLS file.
Versions 09 and later
xlsData
New in version 09
xlsData
xlsData
Retrieves the content of a cell found in an XLS file.
Versions 14 and later
xlsDeleteWorksheet
New in version 14
xlsDeleteWorksheet
xlsDeleteWorksheet
Deletes a worksheet from the Excel document.
Versions 09 and later
xlsMsgError
New in version 09
xlsMsgError
xlsMsgError
Returns the caption of the last error caused by an XLS function.
Versions 09 and later
xlsNbColumn
New in version 09
xlsNbColumn
xlsNbColumn
Returns the number of columns found in a worksheet of an XLS file.
Versions 09 and later
xlsNbRow
New in version 09
xlsNbRow
xlsNbRow
Returns the number of rows found in an XLS file.
Versions 11 and later
xlsNbWorksheet
New in version 11
xlsNbWorksheet
xlsNbWorksheet
Returns the number of worksheets found in an XLS file.
Versions 09 and later
xlsOpen
New in version 09
xlsOpen
xlsOpen
Opens an Excel file (xls or xlsx files).
Versions 12 and later
xlsSave
New in version 12
xlsSave
xlsSave
Saves an XLS document.
Versions 09 and later
xlsVersion
New in version 09
xlsVersion
xlsVersion
Returns the Excel version that was used to save the file.
Related Examples:
XLS Type Unit examples (WINDEV): XLS Type
[ + ] Handling the xlsDocument, xlsColumn, xlsRow and xlsCell variables.
The purpose of this example is to explain how these types of variables can be easily handled.
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment