| void |
activate ( )
Set this worksheet as the active worksheet, i.e. the worksheet that is displayed when the workbook is opened. Also set it as selected.
|
|
|
|
|
|
| void |
close ( $sheetnames )
Add data to the beginning of the workbook (note the reverse order) and to the end of the workbook.
|
|
| void |
fit_to_pages ( $width, $height )
Store the vertical and horizontal number of pages that will define the maximum area printed. It doesn't seem to work with OpenOffice.
|
|
|
|
| string |
get_data ( )
Retrieves data from memory in one chunk, or from disk in $buffer sized chunks.
|
|
| string |
get_name ( )
Retrieve the worksheet name. This is usefull when creating worksheets without a name.
|
|
|
|
|
|
|
|
|
|
|
|
| void |
protect ( $password )
Set the worksheet protection flag to prevent accidental modification and to hide formulas if the locked and hidden format properties have been set.
|
|
|
|
|
|
| void |
select ( )
Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.
|
|
|
|
| void |
set_first_sheet ( )
Set this worksheet as the first visible sheet. This is necessary when there are a large number of worksheets and the activated worksheet is not visible on the screen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| integer |
size_col ( $col )
Convert the width of a cell from user's units to pixels. By interpolation the relationship is: y = 7x +5. If the width hasn't been set by the user we use the default value. If the col is hidden we use a value of zero.
|
|
| integer |
size_row ( $row )
Convert the height of a cell from user's units to pixels. By interpolation the relationship is: y = 4/3x. If the height hasn't been set by the user we use the default value. If the row is hidden we use a value of zero. (Not possible to hide row yet).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| void |
write_url ( $row, $col, $url, [$string = ''], [$format = 0] )
Write a hyperlink. This is comprised of two elements: the visible label and the invisible link. The visible label is the same as the link unless an alternative string is specified. The label is written using the write_string() method. Therefore the 255 characters string limit applies.
|
|
| void |
_append ( $data )
Store Worksheet data in memory using the parent's class append() or to a temporary file, the default.
|
|
| array |
_cell_to_rowcol ( $cell )
Convert an Excel cell reference in A1 notation to a zero based row and column reference; converts C1 to (0, 2).
|
|
|
|
| void |
_initialize ( )
Open a tmp file to store the majority of the Worksheet data. If this fails, for example due to write permissions, store the data in memory. This can be slow for large files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| void |
_store_externsheet ( $sheetname )
Writes the Excel BIFF EXTERNSHEET record. These references are used by formulas. A formula references a sheet name via an index. Since we store a reference to all of the external worksheets the EXTERNSHEET index is the same as the worksheet index.
|
|
| void |
_store_gridset ( )
Write the GRIDSET BIFF record. Must be used in conjunction with the PRINTGRIDLINES record.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| void |
_store_protect ( )
Set the Biff PROTECT record to indicate that the worksheet is protected.
|
|
|
|
|
|
|
|
|
|
| void |
_store_wsbool ( )
Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction with the SETUP record.
|
|
| void |
_store_zoom ( )
Store the window zoom factor. This should be a reduced fraction but for simplicity we will store all fractions with a numerator of 100.
|
|
|
|
|
|
|
|
| void |
_write_url_range ( $row1, $col1, $row2, $col2, $url, [$string = ''], [$format = 0] )
This is the more general form of write_url(). It allows a hyperlink to be written to a range of cells. This function also decides the type of hyperlink to be written. These are either, Web (http, ftp, mailto), Internal (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
|
|
|
|
|
|
See also the _store_print_headers() method below.
The breaks represent the row after which the break is inserted.
Writes the BIFF record ROW.
The breaks represent the column after which the break is inserted.
A blank cell is used to specify formatting without adding a string or a number.
A blank cell without a format serves no purpose. Therefore, we don't write a BLANK record unless a format is specified. This is mainly an optimisation for the write_row() and write_col() methods.
Returns 0 : normal termination (including no format) -1 : insufficient number of arguments -2 : row or column out of range
The textual representation of the formula is passed to the parser in Parser.php which returns a packed binary string.
NOTE records don't have a length limit.
An integer can be written as a double. Excel will display an integer. $format is optional.
NOTE: there is an Excel 5 defined limit of 255 characters. $format is optional. Returns 0 : normal termination -1 : insufficient number of arguments -2 : row or column out of range -3 : long string truncated to 255 chars
$string and $format are optional and their order is interchangeable.
The hyperlink can be to a http, ftp, mail, internal sheet, or external directory url.
Returns 0 : normal termination -1 : insufficient number of arguments -2 : row or column out of range -3 : long string truncated to 255 chars
+------------+------------+ | A | B | +-----+------------+------------+ | |(x1,y1) | | | 1 |(A1)._______|______ | | | | | | | | | | | +-----+----| BITMAP |-----+ | | | | | | 2 | |______________. | | | | (B2)| | | | (x2,y2)| +---- +------------+------------+
Example of a bitmap that covers some of the area from cell A1 to cell B2.
Based on the width and height of the bitmap we need to calculate 8 vars: $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2. The width and height of the cells are also variable and have to be taken into account. The values of $col_start and $row_start are passed in from the calling function. The values of $col_end and $row_end are calculated by subtracting the width and height of the bitmap from the width and height of the underlying cells. The vertices are expressed as a percentage of the underlying cell width as follows (rhs values are in pixels):
x1 = X / W *1024 y1 = Y / H *256 x2 = (X-1) / W *1024 y2 = (Y-1) / H *256
Where: X is distance from the left side of the underlying cell Y is distance from the top of the underlying cell W is the width of the cell H is the height of the cell
This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the MSDN library.
Note: The SDK says the record length is 0x0B but Excel writes a 0x0C length record.
Excel only stores references to external sheets that are used in formulas. For simplicity we store references to all the sheets in the workbook regardless of whether they are used or not. This reduces the overall complexity and eliminates the need for a two way dialogue between the formula parser the worksheet objects.
The panes can either be frozen or thawed (unfrozen). Frozen panes are specified in terms of an integer number of rows and columns. Thawed panes are specified in terms of Excel's units for rows and columns.
Ex: ("A4", "Hello") is converted to (3, 0, "Hello").
Note: Excel writes some relative links with the $dir_long string. We ignore these cases for the sake of simpler code.
See also write_url() above for a general description and return values.
The link type ($options) is 0x03 is the same as absolute dir ref without sheet. However it is differentiated by the $unknown2 data stream.