Quick_reference_guide Xlslib Ref Guide

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 15

DownloadQuick_reference_guide Xlslib Ref Guide
Open PDF In BrowserView PDF
xlsLib
A library for dynamically generating Excel(TM) spreadsheets

PHP Extension's

Quick Reference Guide
Yeico S.A. de C.V.

Copyright 2004 - Yeico S.A. de C.V.

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.
Instantiation:
Usage:

$wb_obj = new workbook;
$retval = wb_obj->operation([$arg1[,$arg2[, ...]]],;

Argument(s)

Operation

Return Value

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

font

string

font_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.
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.

Font name

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.
Instantiation:
Usage:

$ws_obj = $wb_obj->worksheet("Name");
$retval = $ws_obj->operation([$arg1[,$arg2[, ...]]],;

Argument(s)

Operation
blank

label

number

rowheight

colwidth

merge

rangegroup

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

Return Value

Description

cell_t

object

Adds a blank cell to the current worksheet at the
(row,col) position.

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...

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

none

Sets the height size of the 'row_num' row in points.

none

Sets the width size of the 'col_num' column in characterwidths.

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.

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.

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.
Instantiation:
Usage:

$cell_obj = $wb_obj->(args);
$retval = cell_obj->operation([$arg1[,$arg2[, ...]]],;

Argument(s)

Operation

Return Value

Description

Cell Formatting
font

font_t

object

none

It assigns a font object to the cell. The font object fulldefines 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 none
a detailed constant list)

Sets the horizontal alignment of the the text inside the
cell.

valign

valign_option_t

constant (see the appendixes for none
a detailed constant list)

Sets the vertical alignment of the the text inside the
cell.

orientation

txtori_option_t

constant (see the appendixes for none
a detailed constant list)

Sets the text orientation of the cell.

fillfgcolor

color_name_t

constant (see the appendixes for none
a detailed color constant list)

Sets the foreground color of the cell.

fillbgcolor

color_name_t

constant (see the appendixes for none
a detailed color constant list)

Sets the background color of the cell.

fillstyle

color_name_t

constant (see the appendixes for none
a detailed fill-pattern constant list)

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.

borderstyle

border_side_t

constant

none

border_style_t

constant

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.

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

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

Cell Font Style

Other Operations

object

xf_t

object

Gets the format object assigned to the cell.

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.
Instantiation: $range_obj = $wb_obj->ramge(row1, col1, row2, col2);
Usage: $retval = range_obj->operation([$arg1[,$arg2[, ...]]],;

Argument(s)

Operation
cellcolor

color_name_t

constant

Return Value
none

Description
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.

Format Object Operations
An xf_t object can be discretely set using these low level operations.Changing format's settings to an already used
format object using these operations will affect to all cells currently using the format.
Instantiation:
Usage:

$xf_obj = $wb_obj->xformat();
$retval = $xf_obj->operation([$arg1[,$arg2[, ...]]],;

Argument(s)

Operation

object

Return Value
none

Description

SetFont

font_t

Sets the font attached to the format. The font_t object
has to be generated with the workbook's font
operation.

GetFont

none

font_t

GetFormat

none

format_num constant
ber_t

Sets the format for display numbers in the cell. See
the appendixes for a detailed list of choices.

SetFormat

format_number_t

constant

none

Gets the format number of the format object

SetHalign

halign_option_t

constant

none

Sets the text horizontal alignment of the cell. See the
appendixes for a detailed list of available options.

SetValign

valign_option_t

constant

none

Sets the text vertical alignment of the cell. See the
appendixes for a detailed list of available options.

SetTxtOrientation

txtori_option_t

constant

none

Sets the text orientation of the cell. See the
appendixes for a detailed list of available options.

SetFillFGColor

color_name_t

constant

none

Sets the filling pattern foreground color. See the
appendixes for a detailed list of available options.

SetFillBGColor

color_name_t

constant

none

Sets the filling pattern background color. See the
appendixes for a detailed list of available options.

SetFillStyle

fill_option_t

constant

none

Sets the cell's fill pattern style. See the appendixes for
a detailed list of available options.

SetWrap

boolean

0/1

none

If set, the cell that has this format will wrap its text
inside to the boundaries of the cell.

SetBorderStyle

border_side_t

constant

none

border_style_t

constant

Sets the border shape (border_style_t) and color
(color_name_t) of the specified side of the cell
(border_side_t).See the appendixes for a detailed list
of available options.

color_name_t

constant

SetLocked

boolean

0/1

none

Set the cell as locked. Currently protected workbooks
are not supported. so there is no visible effect with
this operation.

SetHidden

boolean

0/1

none

Set the cell as Hidden. Currently protected workbooks
are not supported. so there is no visible effect with
this operation.

object

Retrieves the font attached to the format.

Font Object Operations
A font_t object can be discretely set using these low level operations.Changing font's settings to an already used font
object using these operations will affect to all cells currently using the font.
Instantiation:
Usage:

$xf_obj = $wb_obj->xformat();
$retval = $xf_obj->operation([$arg1[,$arg2[, ...]]],;

Argument(s)

Operation

Return Value

Description

SetName

string

name

none

Sets the name of the font (i.e. "Arial"). You can use
any string and the effect will depend on the *.xls file
reader, most readers will use a default font if the
name is not found to be an installed font.
Sets the height of the font in 1/20th of point units

SetHeight

integer
unsigned16

fntheight

none

SetBoldStyle

boldness_option_t

constant

none

Sets the boldness of the font. See the available
constant choices in the appendixes.

SetUnderlineStyle

underline_option_t

constant

none

Sets the underline style of the font. See the available
constant choices in the appendixes.

SetScriptStyle

script_option_t

constant

none

Sets the script style of the font. See the available
constant choices in the appendixes.

SetColor

color_name_t

constant

none

Sets the color of the font. See the available constant
choices in the appendixes.

SetStrikeout

boolean

0/1

none

If set, the font is strike-out.

SetShadow

boolean

0/1

none

If set, the font is shadowed.

Appendix A. Color Constants.
Color constants Either the numeric value or the constant itself can
be used in operation calls.

color_name_t
Value

Constant

Description

0

COLOR_BLACK

1

COLOR_DARK_RED

black

2

COLOR_RED

3

COLOR_FUCSIA

4

COLOR_COMBINED01

combined 01

5

COLOR_COMBINED02

combined 02

6

COLOR_COMBINED03

combined 03

7

COLOR_COMBINED04

combined 04

8

COLOR_COMBINED05

combined 05
combined 06

dark red
red
fucsia

9

COLOR_COMBINED06

10

COLOR_OLIVE

11

COLOR_DARK_YELLOW

12

COLOR_COMBINED07

13

COLOR_YELLOW

14

COLOR_LIGHT_YELLOW

light yellow

15

COLOR_DARK_GREEN

dark green

16

COLOR_GREEN

17

COLOR_COMBINED08

18

COLOR_LIVING_GREEN

living green

19

COLOR_LIGHT_GREEN

light green

20

COLOR_COMBINED09

combined 09

21

COLOR_BLUE_GREEN

blue green

22

COLOR_AQUAMARINA

aquamarine

23

COLOR_TURQOISE

24

COLOR_COMBINED10

combined 10

25

COLOR_DARK_BLUE

dark blue

26

COLOR_BLUE

blue

27

COLOR_LIGHT_BLUE

blue

28

COLOR_SKY_BLUE

29

COLOR_COMBINED11

30

COLOR_INDIGO

31

COLOR_BLUE_GRAY

32

COLOR_VIOLET

33

COLOR_PLUM

34

COLOR_LAVANDER

35

COLOR_COMBINED12

36

COLOR_GRAY50

gray50

37

COLOR_GRAY40

gray40

38

COLOR_GRAY25

gray25

39

COLOR_WHITE

olive
dark yellow
combined 07
yellow

green
combined 08

turquoise

sky blue
combined 11
indigo
blue gray
violet
plum
lavender
combined 12

white

Appendix B. Border constants
Either the numeric value or the constant itself can be used in
operation calls.

border_style_t
Value

Constant

Description

0

BORDER_NONE

none

1

BORDER_THIN

thin

2

BORDER_MEDIUM

medium

3

BORDER_DASHED

dashed

4

BORDER_DOTTED

dotted

5

BORDER_THICK

6

BORDER_DOUBLE

7

BORDER_HAIR

thick
double
hair

border_side_t
Value

Constant

Description

0

BORDER_BOTTOM

Bottom side

1

BORDER_TOP

Top side

2

BORDER_LEFT

Left side

3

BORDER_RIGHT

Right side

Appendix C. Fill Pattern Constants.
Cell fill pattern constants. Either the numeric value or the constant itself can be used in
operation calls.

fill_option_t
Value

Constant

Description

0

FILL_NONE

No fill

1

FILL_SOLID

Solid

2

FILL_ATEN75

75% attenuation

3

FILL_ATEN50

50% attenuation

4

FILL_ATEN25

25% attenuation

5

FILL_ATEN12

12% attenuation

6

FILL_ATEN06

6% attenuation

7

FILL_HORIZ_LIN

Horizontal lines

8

FILL_VERTICAL_LIN

Vertical lines

9

FILL_DIAG

Diagonal lines

10

FILL_INV_DIAG

Inverted diagonal lines

11

FILL_INTER_DIAG

Diagonal interlaced lines

12

FILL_DIAG_THICK_INTER

Diagonal interlaced thick
lines

13

FILL_HORIZ_LINES_THIN

Horizontal thin lines

14

FILL_VERTICAL_LINES_THIN

Vertical thin lines

15

FILL_DIAG_THIN

Diagonal thin lines.

16

FILL_INV_DIAG_THIN

Inverted diagonal thin lines

17

FILL_HORIZ_INT_THIN

Horizontal interlaced thin
lines

18

FILL_HORIZ_INTER_THICK

Horizontal interlaced thick
lines

Sample

Appendix D. Text Alignment Constants.
Cell horizontal/vertical text alignment constants. Either the
numeric value or the constant itself can be used in operation calls.

halign_option_t
Value

Constant

Description
General horizontal alignment

0

HALIGN_GENERAL
Left horizontal alignment

1

HALIGN_LEFT
Center horizontal alignment

2

HALIGN_CENTER
Right horizontal alignment

3

HALIGN_RIGHT

Fill horizontal alignment - Fill horizontal alignment - Fill horizontal alignme
4

5

HALIGN_FILL

HALIGN_JUSTIFY

Justify horizontal alignment sample Justify horizontal alignment sample Justify horizontal alignment sample

Center-across horizontal alignment - Center-across horizontal alignment
6

HALIGN_CENTERACROSS

valign_option_t
Value

Constant

Description
Top vertical alignment

0

VALIGN_TOP

1

VALIGN_CENTER

2

VALIGN_BOTTOM

Center vertical alignment

Bottom vertical alignment
Justify vertical alignment - Justify
3

VALIGN_JUSTIFY

vertical alignment - Justify vertical
alignment - Justify vertical alignment

txtori_option_t
Value

Constant

Description
Default text orientation

0

1

ORI_NONE

ORI_TOPBOTTOMTXT

T
o
p
b
o
t
t
o
m

ORI_90NOCLOCKTXT

3

ORI_90CLOCKTXT

90 deg. counterclockwise text orientation

2

90 deg. clockwise text orientation

t
e
x
t

Appendix D. Text Style Constants.
Text style (bold, underline, script) constants. Either the numeric
value or the constant itself can be used in operation calls.

boldness_option_t
Value

Constant

0

BOLDNESS_BOLD

1

BOLDNESS_HALF

2

BOLDNESS_NORMAL

3

BOLDNESS_DOUBLE

Description

Yeico
Yeico
Yeico
Yeico

script_option_t
Value

Constant

0

SCRIPT_NONE

1

SCRIPT_SUPER

2

SCRIPT_SUB

Description

Yeico
Yeico
Yeico

underline_option_t
Value

Constant

Description

0

UNDERLINE_NONE

1

UNDERLINE_SINGLE

2

UNDERLINE_DOUBLE

3

UNDERLINE_SINGLEACC

Yeico
Yeico
Yeico
Yeico

4

UNDERLINE_DOUBLEACC

Yeico

Appendix D. Text Alignment Constants.
Number formatting. Either the numeric value or the constant itself can
be used in operation calls.

format_number_t
Value

Constant

0

FMT_GENERAL

1

FMT_NUMBER1

2

FMT_NUMBER2

3

FMT_NUMBER3

4

FMT_NUMBER4

5

FMT_CURRENCY1

6

FMT_CURRENCY2

7

FMT_CURRENCY3

8

FMT_CURRENCY4

9

FMT_PERCENT1

10

FMT_PERCENT2

11

FMT_SCIENTIFIC1

12

FMT_FRACTION1

13

FMT_FRACTION2

14

FMT_DATE1

15

FMT_DATE2

16

FMT_DATE3

17

FMT_DATE4

18

FMT_HOUR1

19

FMT_HOUR2

20

FMT_HOUR3

21

FMT_HOUR4

22

FMT_HOURDATE

23

FMT_NUMBER5

24

FMT_NUMBER6

25

FMT_NUMBER7

26

FMT_NUMBER8

27

FMT_ACCOUNTING1

28

FMT_ACCOUNTING2

29

FMT_ACCOUNTING3

30

FMT_ACCOUNTING4

31

FMT_HOUR5

32

FMT_HOUR6

33

FMT_HOUR7

34

FMT_SCIENTIFIC2

35

FMT_TEXT

Sample
12345.12345 =

12345.12345

12345.12345 =

12345

12345.12345 =

12345.12

12345.12345 =

12,345

12345.12345 =

12,345.12

12345.12345 =

$12,345

12345.12345 =

$12,345

12345.12345 =

$12,345.12

12345.12345 =

$12,345.12

12345.12345 =
12345.12345 =

1234512%
1234512.35%

12345.12345 =

1.23E+04

12345.12345 =

12345 1/8

12345.12345 =

12345 10/81

12345 =

18/10/1933

12345 =

18-Oct-33

12345 =

18-Oct

12345 =

Oct-33

12345 =
12345 =

12:00 a.m.
12:00:00 a.m.

12345 =

00:00

12345 =
12345 =

00:00:00
18/10/1933 00:00

12345.12345 =

12,345

12345.12345 =

12,345

12345.12345 =

12,345.12

12345.12345 =

12,345.12

12345.12345 =
12345.12345 =

12,345
$

12345.12345 =
12345.12345 =
12345 =
12345 =
12345 =
12345 =
12345 =

12,345
12,345.12

$

12,345.12
00:00

296280:00:00
00:00.0
12.3E+3
12345

Appendix G. Sample Fonts.
Some font samples. These are only the default installed fonts of MS Excel (TM) (and most of the xls-spreadsheet readers).
The name of the font can be plainly used when assigning the font name (any string is valid).
Note that using non-default fonts is not recommended, since there is no warranty that the font will be installed in the client's
PC.

Fonts
Arial
Arial Narrow
Arial Narrow
Bookman Old Style
Courier
Helvetica
Σψµβολ

Test



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.2
Linearized                      : No
Page Count                      : 15
Producer                        : AFPL Ghostscript 8.0
Create Date                     : 2004:03:19 13:24:32
Modify Date                     : 2004:03:19 13:24:32
Title                           : quick_reference_guide.xls
Creator                         : PScript5.dll Version 5.2
Author                          : dgonzalez
EXIF Metadata provided by EXIF.tools

Navigation menu