Class for generating Excel Spreadsheets
Located in /libraries/pear/Spreadsheet/Excel/Writer/Worksheet.php (line 46)
PEAR | --Spreadsheet_Excel_Writer_BIFFwriter | --Spreadsheet_Excel_Writer_Worksheet
Index for the Worksheet
Name of the Worksheet
Last column of the area to print
First column of the area to print
Last row to of the area to print
First row of the area to print
Bit specifying if the worksheet is selected
First column to reapeat on each printed page
Last row to reapeat on each printed page
First row to reapeat on each printed page
The active pane for the worksheet
Array containing format information for columns
Last column for the DIMENSIONS record
First column for the DIMENSIONS record
Last row for the DIMENSIONS record
First row for the DIMENSIONS record
Filehandle to the temporary file for storing data
Number of pages to fit high
Whether to fit to page when printing or not.
Number of pages to fit wide
The page footer caption
Bit specifying if panes are frozen
The horizontal centering value for the page
The page header caption
The bottom margin for the worksheet in inches
The margin for the footer
The margin for the header
The left margin for the worksheet in inches
The right margin for the worksheet in inches
The top margin for the worksheet in inches
Merged cell ranges
Bit specifying paper orientation (for printing). 0 => landscape, 1 => portrait
Whether to have outline summary below.
Whether to use outline.
Whether to have outline summary at the right.
Outline row level.
Auto outline styles.
Array containing the panes for the worksheet
The paper size (for printing) (DOCUMENT!!!)
Reference to the parser used for parsing formulas
Array containing the selected area for the worksheet
Reference to the array containing all the unique strings in the workbook
Reference to the total number of strings in the workbook
Reference to the number of unique strings in the workbook
Reference to the (default) Format object for URLs
Boolean indicating if we are using a temporary file for storing data
The vertical centering value for the page
Maximum number of columns for an Excel spreadsheet (BIFF5)
Maximum number of rows for an Excel spreadsheet (BIFF5)
Maximum number of characters for a string (LABEL record in BIFF5)
Inherited from Spreadsheet_Excel_Writer_BIFFwriter
Spreadsheet_Excel_Writer_BIFFwriter::$_BIFF_version
Spreadsheet_Excel_Writer_BIFFwriter::$_byte_order
Spreadsheet_Excel_Writer_BIFFwriter::$_data
Spreadsheet_Excel_Writer_BIFFwriter::$_datasize
Spreadsheet_Excel_Writer_BIFFwriter::$_limit
Constructor
Set this worksheet as the active worksheet, i.e. the worksheet that is displayed when the workbook is opened.
Also set it as selected.
Center the page horinzontally.
Center the page vertically.
Add data to the beginning of the workbook (note the reverse order) and to the end of the workbook.
Set the vertical and horizontal number of pages that will define the maximum area printed.
It doesn't seem to work with OpenOffice.
Set panes and mark them as frozen.
Retrieves data from memory in one chunk, or from disk in $buffer sized chunks.
Retrieve the worksheet name.
This is usefull when creating worksheets without a name.
Set the option to hide gridlines on the printed page.
Set the option to hide gridlines on the worksheet (as seen on the screen).
Insert a 24bit bitmap image in a worksheet.
Merges the area given by its arguments.
This is an Excel97/2000 method. It is required to perform more complicated merging than the normal setAlign('merge').
Set the area of each worksheet that will be printed.
Set the option to print the row and column headers on the printed page.
Set the worksheet protection flag to prevent accidental modification and to hide formulas if the locked and hidden format properties have been set.
Set the columns to repeat at the left hand side of each printed page.
Set the rows to repeat at the top of each printed page.
Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.
Set the width of a single column or a range of columns.
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.
Set the page footer caption and optional margin.
Set the page header caption and optional margin.
Store the horizontal page breaks on a worksheet (for printing).
The breaks represent the row after which the break is inserted.
Set the page orientation as landscape.
Set the bottom margin in inches.
Set the left margin in inches.
Set the right margin in inches.
Set all the page margins to the same value in inches.
Set the left and right margins to the same value in inches.
Set the top and bottom margins to the same value in inches.
Set the top margin in inches.
Sets a merged cell range
This method sets the properties for outlining and grouping. The defaults correspond to Excel's defaults.
Set the paper type. Ex. 1 = US Letter, 9 = A4
Set the page orientation as portrait.
Set the scale factor for the printed page.
It turns off the "fit to page" option
This method is used to set the height and format for a row.
Set which cell or cells are selected in a worksheet
FIXME: add comments
Store the vertical page breaks on a worksheet (for printing).
The breaks represent the column after which the break is inserted.
Set the worksheet zoom factor.
Set panes and mark them as unfrozen.
Map to the appropriate write method acording to the token recieved.
Write a blank cell to the specified row and column (zero indexed).
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.
Returns 0 : normal termination (including no format) -1 : insufficient number of arguments -2 : row or column out of range
Write an array of values as a column
Write a formula to the specified row and column (zero indexed).
The textual representation of the formula is passed to the parser in Parser.php which returns a packed binary string.
Returns 0 : normal termination -1 : formula errors (bad formula) -2 : row or column out of range
Writes a note associated with the cell given by the row and column.
NOTE records don't have a length limit.
Write a double to the specified row and column (zero indexed).
An integer can be written as a double. Excel will display an integer. $format is optional.
Returns 0 : normal termination -2 : row or column out of range
Write an array of values as a row
Write a string to the specified row and column (zero indexed).
NOTE: there is an Excel 5 defined limit of 255 characters. $format is optional. Returns 0 : normal termination -2 : row or column out of range -3 : long string truncated to 255 chars
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 writeString() method. Therefore the 255 characters string limit applies. $string and $format are optional.
The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external directory url.
Returns 0 : normal termination -2 : row or column out of range -3 : long string truncated to 255 chars
Store Worksheet data in memory using the parent's class append() or to a temporary file, the default.
Convert an Excel cell reference in A1 notation to a zero based row and column reference; converts C1 to (0, 2).
Check row and col before writing to a cell, and update the sheet's dimensions accordingly
Based on the algorithm provided by Daniel Rentz of OpenOffice.
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.
Calculate the vertices that define the position of the image as required by the OBJ record.
+------------+------------+ | 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
Convert a 24 bit bitmap into the modified internal format used by Windows.
This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the MSDN library.
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.
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).
Write BIFF record COLINFO to define column widths
Note: The SDK says the record length is 0x0B but Excel writes a 0x0C length record.
Store the DVAL and DV records.
Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
Writes Excel DIMENSIONS to define the area in which there is data.
Write BIFF record EXTERNCOUNT to indicate the number of external sheet references in a worksheet.
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.
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.
Store the footer caption BIFF record.
Write the GRIDSET BIFF record. Must be used in conjunction with the PRINTGRIDLINES record.
Write the GUTS BIFF record. This is used to configure the gutter margins where Excel outline symbols are displayed. The visibility of the gutters is controlled by a flag in WSBOOL.
Write the HORIZONTALPAGEBREAKS BIFF record.
Store the horizontal centering HCENTER BIFF record.
Store the header caption BIFF record.
Store the BOTTOMMARGIN BIFF record.
Store the LEFTMARGIN BIFF record.
Store the RIGHTMARGIN BIFF record.
Store the TOPMARGIN BIFF record.
Store the MERGEDCELLS record for all ranges of merged cells
Store the OBJ record that precedes an IMDATA record. This could be generalise to support other Excel objects.
Writes the Excel BIFF PANE record.
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.
Write the worksheet PASSWORD record.
Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the GRIDSET record.
Write the PRINTHEADERS BIFF record.
Set the Biff PROTECT record to indicate that the worksheet is protected.
Write BIFF record SELECTION.
Store the page setup SETUP BIFF record.
Write the VERTICALPAGEBREAKS BIFF record.
Store the vertical centering VCENTER BIFF record.
Write BIFF record Window2.
Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction with the SETUP record.
Store the window zoom factor. This should be a reduced fraction but for simplicity we will store all fractions with a numerator of 100.
Substitute an Excel cell reference in A1 notation for zero based row and column values in an argument list.
Ex: ("A4", "Hello") is converted to (3, 0, "Hello").
Write links to external directory names such as 'c:\foo.xls', c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'.
Note: Excel writes some relative links with the $dir_long string. We ignore these cases for the sake of simpler code.
Used to write internal reference hyperlinks such as "Sheet1!A1".
This is the more general form of writeUrl(). 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').
Used to write http, ftp and mailto hyperlinks.
The link type ($options) is 0x03 is the same as absolute dir ref without sheet. However it is differentiated by the $unknown2 data stream.
Returns an index to the XF record in the workbook
Inherited From Spreadsheet_Excel_Writer_BIFFwriter
Spreadsheet_Excel_Writer_BIFFwriter::Spreadsheet_Excel_Writer_BIFFwriter()
Spreadsheet_Excel_Writer_BIFFwriter::_addContinue()
Spreadsheet_Excel_Writer_BIFFwriter::_append()
Spreadsheet_Excel_Writer_BIFFwriter::_prepend()
Spreadsheet_Excel_Writer_BIFFwriter::_setByteOrder()
Spreadsheet_Excel_Writer_BIFFwriter::_storeBof()
Spreadsheet_Excel_Writer_BIFFwriter::_storeEof()
Documentation generated on Fri, 11 Feb 2005 18:14:39 +0000 by phpDocumentor 1.3.0RC3