xlsLib
Copyright 2004 - Yeico S.A. de C.V.
A library for dynamically generating Excel(TM) spreadsheets
PHP Extension's
Quick Reference Guide
Yeico S.A. de C.V.
Instantiation:
Usage:
Operation Description
Stroke string Name none Sends the spreadsheet hold by the workbook object to
the client. The file gets the name set by the 'Name'
argument.
Dump string Name none Writes the spreadsheet hold by the workbook to a file
'Name'. Only recommended when the script is called
from the Command Line.
Disposition constant {STK_INLINE,
STK_ATTACHMENT}
none
Defines the way the file will be managed by the client (if
it is supported)'. i.e. STK_INLINE will automatically
open the default application.
sheet string NameSheet worksheet object Creates a worksheet in the current workbook assigning
the name passed as argument.
xformat none xf_t object Creates a customizable extended format object that
can be passed as an arguments to any cell element. All
format objects used by the workbook's elements have
to be generated with this operation.
font string Font name font_t object Creates a customizable font object that can be passed
as an arguments to a format object element. All font
objects used by the workbook's elements have to be
generated with this operation.
Argument(s) Return Value
Workbook Operations
workbook is the base object of the library. All other objects are generated in it, and it controls the streaming of the generated file.
$wb_obj = new workbook;
$retval = wb_obj->operation([$arg1[,$arg2[, ...]]],;
Instantiation:
Usage:
Operation Description
integer
unsigned16
row
integer
unsigned16
col
xf_t object
integer
unsigned16
row
integer
unsigned16
col
string label_text
xf_t object
integer
unsigned16
row
integer
unsigned16
col
double number
constant
format_number_t (See the table of
values in the appendixes)
xf_t object
integer
unsigned16
row_num
integer
unsigned16
height
integer
unsigned16
col_num
integer
unsigned16
width
integer
unsigned16
col_1
integer
unsigned16
row_1
integer
unsigned16
col_2
integer
unsigned16
row_2
integer
unsigned16
col_1
integer
unsigned16
row_1
integer
unsigned16
col_2
integer
unsigned16
row_2
rangegroup range object Returns an object that handles a group of cells given
by the range defined with the arguments. This range
object can be seen and modified as a cell unit and all
format setting (including borders) will apply to all of the
cells inside the range.
merge none Merges the given range of cells in to one. The format
used to display the cell's valueis the top-left most of the
range.
colwidth none
Sets the width size of the 'col_num' column in character-
widths.
rowheight none Sets the height size of the 'row_num' row in points.
number cell_t object Adds a number cell to the current worksheet at the
(row,col) position usinga format_number_t constant to
format number's display
Adds a blank cell to the current worksheet at the
(row,col) position.
label cell_t object Adds a label cell to the current worksheet at the
(row,col) position using'label_text' as the text of the
label. NOTE: Due format specifications, text inside a
label cannot be longer than 255 chars; if a longer input
is used, the text is truncated with...
Argument(s) Return Value
blank cell_t object
Worksheet Operations
The worksheet object handles a logical sheet-unit. It is the source of cell-objects , and it controls general cell sizing and
merging.
$ws_obj = $wb_obj->worksheet("Name");
$retval = $ws_obj->operation([$arg1[,$arg2[, ...]]],;
Instantiation:
Usage:
Operation Description
font font_t object none It assigns a font object to the cell. The font object full-
defines the font to be used by the cell. Its use is
recommended for defining the same font style to
multiple cells. For discrete font settings, use of the
following operations are recommended.
format format_number_t constant none It assigns a formatting number to the cell (it will be
used only if the cell contains a number). See the
appendixes for a detailed list of format constants
halign halign_option_t constant (see the appendixes for
a detailed constant list)
none Sets the horizontal alignment of the the text inside the
cell.
valign valign_option_t constant (see the appendixes for
a detailed constant list)
none Sets the vertical alignment of the the text inside the
cell.
orientation txtori_option_t constant (see the appendixes for
a detailed constant list)
none Sets the text orientation of the cell.
fillfgcolor color_name_t constant (see the appendixes for
a detailed color constant list)
none Sets the foreground color of the cell.
fillbgcolor color_name_t constant (see the appendixes for
a detailed color constant list)
none Sets the background color of the cell.
fillstyle color_name_t constant (see the appendixes for
a detailed fill-pattern constant list)
none Sets the fill-pattern of the cell.Back/fore-ground colors
are related to these patterns.
wrap boolean 1/0 none
If set, text inside the cell is wrapped in the current cell's
size.
border_side_t constant
border_style_t constant
color_name_t constant
locked boolean 1/0 none If set, the cell is locked. Currently it has no effect,
since worksheet protection is not implemented yet.
hidden boolean 1/0 none If set, the cell is hidden. Currently it has no effect,
since worksheet protection is not implemented yet.
fontname string name none Sets font's name to be used by the cell. You can pass
any string, but in in order to have any effect, is has to
be the name of a font supported by your *.xls file
reader. When a non supported font is passed, the
behavior when opening the file will depe...
fontheight number (unsigned16) fntheight none Sets the height of the cell's font. The height is set in
1/20th of point: i.e fontheight=200 sets the font's height
to 10.
fontbold boldness_option_t constant none Sets the boldness of the cell's font according to the
font_boldness_t constant. See the appendixes for a
detailed list of available constants.
fontunderline underline_option_t constant none Sets the underline style of the cell's font according to
the font_underline_t constant. See the appendixes for
a detailed list of available constants.
fontscript script_option_t {SCRIPT_NONE,
SCRIPT_SUPER,
SCRIPT_SUB}
none Sets the script style (super/under-script) of the cell's
font according to the font_underline_t constant.
fontcolor color_name_t constant none Sets the color of the cell's font according to the
font_underline_t constant See the appendixes for a
detailed list of available color constants.
fontitalic boolean 0/1 none If set, the cell's font is shown italic shaped.
fontstrikeout boolean 0/1 none If set, the cell's font is shown strike-out shaped.
fontshadow boolean 0/1 none If set, the cell's font is shown with shadow (if
supported).
GetRow none integer
unsigned16
Returns the cell's row number (0-index based) of the
current cell.
GetCol none integer
unsigned16
Returns the cell's column number (0-index based) of
the current cell.
SetXF xf_t object none Sets the cell's format to the one passed as argument.
The xf_t object has to be previously generated with the
wb_obj->xformat()
GetXF none xf_t object Gets the format object assigned to the cell.
Cell Font Style
Other Operations
Argument(s) Return Value
Cell Formatting
borderstyle none Sets the border selected by border_side_t to the
border_style_t style andcolor_name_t color. All
standard styles and colors are supported. See the
appendixes for a full list of available constants.
Cell Operations
Any cell-type (blank, label, number) falls into this category and these operations can be applied to them. Standard format
and font manipulation can be performed on any cell.
$cell_obj = $wb_obj-><blank|label|number>(args);
$retval = cell_obj->operation([$arg1[,$arg2[, ...]]],;
Instantiation:
Usage:
Operation Description
cellcolor color_name_t constant none Sets the background color of each cell inside the
range. This is a wrapper function to an operation that
involves changing the fill-pattern and color of each
cell.
Argument(s) Return Value
Range Operations
A range can be seen as a cell. The same operations of a cell apply to a range. Note that for border settings, borders are
set to each member of the range.
Besides cell operations, the following table shows some extra operations, specific to range objects.
$range_obj = $wb_obj->ramge(row1, col1, row2, col2);
$retval = range_obj->operation([$arg1[,$arg2[, ...]]],;