Writes a number or date/time into cell with optionally specified format.
xlHandle to an Excel file is obtained by the XLCreateFromTemplate function. formatHandle is an optional parameter which can be omitted. A formatHandle can be obtained by a call to XLAddFormat.htm.
row and column are zero based. Please remember that Excel files have limits like 65536 rows and 256 columns.
Parameters:
Name |
Type |
Value |
Description |
xlHandle |
Integer |
0 - n |
A handle to an Excel document. The document must have been created by using the function XLCreateFromTemplate and the Integer we obtained from it is used as xlHandle here. |
row |
Integer |
0 - n |
Index of row to write to |
column |
Integer |
0 - n |
Index of column to write to |
value |
Double |
0 - n |
Writes a number or date/time into cell with specified format |
formatHandle |
Integer |
0 - n |
Optional handle to a format object. The formatHandle is is obtained by a call to XLAddFormat |
Available in:
WindowMain |
WindowLink |
YES |
NO |
Used in:
XojoScript Name |
GUID |
Save As Excel sheet : participants list |
E50602AA-F1F7-42E6-A44A-78456DD9B778 |
Save as Excel sheet : seminar participants list |
03C22A3D-FF28-4E22-BB99-D7626BF5F0A4 |
Save as Excel sheet : seminar invoice list |
6DDAFA87-2862-4129-8416-CBD57C5CDF9A |
Hint: You can find more references to XojoScripts which make use of this function by sending the following SQL statement to the database:
Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%XLWriteNumber%'
Example XojoScript:
Dim hXL As Integer
// Get Handle to newly created Excel file
hXL = XLCreateFromTemplate("myXLtest.xls")
// Add Format for vertical alignment
Dim frmtHandle As Integer = XLAddFormat(hXL)
// Set Alignment of Format
XLFormatSetAlign(hXL, frmtHandle, "ALIGNV", "ALIGNVCENTER")
If hXL > -1 Then
Dim i As integer
Dim h As Double = 25
For i = 2 To 100
// Set row height
XLSetRowHeight(hXL,frmtHandle,i,h)
XLWriteString(hXL,i,0,"Zeile " + Str(i),frmtHandle)
XLWriteNumber(hXL,i,1,i,frmtHandle)
Next
// Set Column Widths, -1 = AutoFit
Dim w As Double = 10
XLSetColWidth(hXL,0,0,w)
XLSetColWidth(hXL,1,2,-1) // AutoFit
XLSave(hXL)
XL(hXL,"launch")
End If