PHPExcel_Writer_Excel5_Worksheet
| category | PHPExcel |
|---|---|
| package | PHPExcel_Writer_Excel5 |
| copyright | Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
__construct(int $str_total, int $str_unique, array $str_table, array $colors, mixed $parser, boolean $preCalculateFormulas, string | \PHPExcel_Worksheet $phpSheet)
int&$str_total Total number of strings
int&$str_unique Total number of unique strings
array&$str_table String Table
array&$colors Colour Table
mixedThe formula parser created for the Workbook
booleanFlag indicating whether formulas should be calculated or just written
_addContinue(string $data) : string
In Excel 5 the limit is 2084 bytes. In Excel 97 the limit is 8228 bytes. Records that are longer than these limits must be split up into CONTINUE blocks.
This function takes a long BIFF record and inserts CONTINUE records as necessary.
| access | private |
|---|---|
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_addContinue() |
stringThe original binary data to be written
stringA very convenient string of continue blocks_append(string $data)
| access | private |
|---|---|
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_append() |
stringbinary data to append
_positionImage(integer $col_start, integer $row_start, integer $x1, integer $y1, integer $width, integer $height)
+------------+------------+ | 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 The SDK incorrectly states that the height should be expressed as a percentage of 1024.
| access | private |
|---|
integerCol containing upper left corner of object
integerRow containing top left corner of object
integerDistance to left side of object
integerDistance to top of object
integerWidth of image frame
integerHeight of image frame
_processBitmap(string $bitmap) : array
This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the MSDN library.
| access | private |
|---|
stringThe bitmap to process
arrayArray with data and properties of the bitmap_processBitmapGd(resource $image) : array
| access | private |
|---|
resourceThe image to process
arrayArray with data and properties of the bitmap_storeBof(integer $type)
| access | private |
|---|---|
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_storeBof() |
integerType of BIFF file to write: 0x0005 Workbook, 0x0010 Worksheet.
_storeEof()
| access | private |
|---|---|
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_storeEof() |
_writeBlank(integer $row, integer $col, mixed $xfIndex)
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
integerZero indexed row
integerZero indexed column
mixedThe XF format index
_writeUrlExternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url) : integer
./../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.
| access | private |
|---|---|
| see | \_writeUrl() |
integerStart row
integerStart column
integerEnd row
integerEnd column
stringURL string
integer_writeUrlInternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url) : integer
| access | private |
|---|---|
| see | \_writeUrl() |
integerStart row
integerStart column
integerEnd row
integerEnd column
stringURL string
integer_writeUrlRange(integer $row1, integer $col1, integer $row2, integer $col2, string $url) : integer
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').
| access | private |
|---|---|
| see | \_writeUrl() |
integerStart row
integerStart column
integerEnd row
integerEnd column
stringURL string
integer_writeUrlWeb(integer $row1, integer $col1, integer $row2, integer $col2, string $url) : integer
The link type ($options) is 0x03 is the same as absolute dir ref without sheet. However it is differentiated by the $unknown2 data stream.
| access | private |
|---|---|
| see | \_writeUrl() |
integerStart row
integerStart column
integerEnd row
integerEnd column
stringURL string
integerclose()
| access | public |
|---|---|
| see | \PHPExcel_Writer_Excel5_Workbook::storeWorkbook() |
getByteOrder() : int
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder() |
|---|
intgetData() : string
stringThe datainsertBitmap(integer $row, integer $col, mixed $bitmap, integer $x, integer $y, float $scale_x, float $scale_y)
| access | public |
|---|
integerThe row we are going to insert the bitmap into
integerThe column we are going to insert the bitmap into
mixedThe bitmap filename or GD-image resource
integerThe horizontal position (offset) of the image inside the cell.
integerThe vertical position (offset) of the image inside the cell.
floatThe horizontal scale
floatThe vertical scale
printRowColHeaders(integer $print)
| access | public |
|---|
integerWhether to print the headers or not. Defaults to 1 (print).
setEscher(\PHPExcel_Shared_Escher $pValue)
\PHPExcel_Shared_Escher
setOutline(bool $visible, bool $symbols_below, bool $symbols_right, bool $auto_style)
The defaults correspond to Excel's defaults.
bool
bool
bool
bool
writeData(string $data) : string
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::writeData() |
|---|
stringbinary data to write
stringwriteEof()
| access | private |
|---|---|
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::writeEof() |
_mapErrorCode(string $errorCode) : int
string
int_writeAutoFilterInfo()
This is used to configure the number of autofilter select used in the sheet.
_writeBIFF8CellRangeAddressFixed(string $range) : string
stringE.g. 'A1' or 'A1:B6'
stringBinary data_writeBoolErr(int $row, int $col, int $value, boolean $isError, int $xfIndex)
intRow index (0-based)
intColumn index (0-based)
int
booleanError or Boolean?
int
_writeBreaks()
_writeCFHeader()
_writeCFRule(\PHPExcel_Style_Conditional $conditional)
\PHPExcel_Style_Conditional
_writeColinfo(array $col_array)
Note: The SDK says the record length is 0x0B but Excel writes a 0x0C length record.
arrayThis is the only parameter received and is composed of the following: 0 => First formatted column, 1 => Last formatted column, 2 => Col width (8.43 is Excel default), 3 => The optional XF format of the column, 4 => Option flags. 5 => Optional outline level
_writeDataValidity()
_writeDefaultRowHeight()
_writeDefcol()
_writeDimensions()
_writeExterncount(integer $count)
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.
integerThe number of external sheet references in this worksheet
_writeExternsheet(string $sheetname)
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.
stringThe name of a external worksheet
_writeFormula(integer $row, integer $col, string $formula, mixed $xfIndex, mixed $calculatedValue) : integer
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
integerZero indexed row
integerZero indexed column
stringThe formula text string
mixedThe XF format index
mixedCalculated value
integer_writeGridset()
Must be used in conjunction with the PRINTGRIDLINES record.
_writeGuts()
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.
| see | \_writeWsbool() |
|---|
_writeHcenter()
| access | private |
|---|
_writeHeader()
_writeLabel(integer $row, integer $col, string $str, mixed $xfIndex) : integer
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
| access | public |
|---|
integerZero indexed row
integerZero indexed column
stringThe string to write
mixedThe XF format index for the cell
integer_writeLabelSst(integer $row, integer $col, string $str, mixed $xfIndex) : integer
This is the BIFF8 version (no 255 chars limit). $format is optional. Returns 0 : normal termination -2 : row or column out of range -3 : long string truncated to 255 chars
| access | public |
|---|
integerZero indexed row
integerZero indexed column
stringThe string to write
mixedThe XF format index for the cell
integer_writeMarginBottom()
_writeMarginLeft()
_writeMarginRight()
_writeMarginTop()
_writeMergedCells()
_writeMsoDrawing()
_writeNote(integer $row, integer $col, string $note)
NOTE records don't have a length limit.
integerZero indexed row
integerZero indexed column
stringThe note to write
_writeNumber(integer $row, integer $col, float $num, mixed $xfIndex) : integer
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
integerZero indexed row
integerZero indexed column
floatThe number to write
mixedThe optional XF format
integer_writeObjPicture(integer $colL, integer $dxL, integer $rwT, integer $dyT, integer $colR, integer $dxR, integer $rwB, integer $dyB)
This could be generalise to support other Excel objects.
integerColumn containing upper left corner of object
integerDistance from left side of cell
integerRow containing top left corner of object
integerDistance from top of cell
integerColumn containing lower right corner of object
integerDistance from right of cell
integerRow containing bottom right corner of object
integerDistance from bottom of cell
_writeObjectProtect()
_writePageLayoutView()
_writePanes()
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.
_writePassword()
_writePrintGridlines()
Must be used in conjunction with the GRIDSET record.
_writePrintHeaders()
_writeProtect()
_writeRangeProtection()
Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records
_writeRichTextString(int $row, int $col, string $str, mixed $xfIndex, array $arrcRun)
Which one depends on BIFF version It differs from _writeString by the writing of rich text strings.
intRow index (0-based)
intColumn index (0-based)
stringThe string
mixedThe XF format index for the cell
arrayIndex to Font record and characters beginning
_writeRow(integer $row, integer $height, integer $xfIndex, bool $hidden, integer $level)
integerThe row to set
integerHeight we are giving to the row. Use null to set XF without setting height
integerThe optional cell style Xf index to apply to the columns
boolThe optional hidden attribute
integerThe optional outline level for row, in range [0,7]
_writeScenProtect()
_writeSelection()
_writeSetup()
_writeSheetLayout()
_writeSheetProtection()
_writeString(int $row, int $col, string $str, int $xfIndex)
Which one depends on BIFF version
intRow index (0-based)
intColumn index (0-based)
stringThe string
intIndex to XF record
_writeStringRecord(string $stringValue)
This
string
_writeUrl(integer $row, integer $col, string $url) : integer
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
integerRow
integerColumn
stringURL string
integer_writeVcenter()
_writeWindow2()
_writeWsbool()
Used in conjunction with the SETUP record.
_writeZoom()
This should be a reduced fraction but for simplicity we will store all fractions with a numerator of 100.
$_active_pane : integer
$_colinfo : array
$_data : string
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_data |
|---|
$_datasize : integer
Should be the same as strlen($this->_data)
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_datasize |
|---|
$_fntHashIndex : array
$_limit : integer
See _addContinue()
| see | \_addContinue() |
|---|---|
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_limit |
$_outline_below : bool
$_outline_on : integer
$_outline_right : bool
$_outline_style : bool
$_phpSheet : \PHPExcel_Worksheet
$_selection : array
$_str_table : array
$_str_total : integer
$_str_unique : integer
$_xls_strmax : integer
$_byte_order : integer
0 => little endian, 1 => big endian
| inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::$$_byte_order |
|---|
$_colors
$_countCellStyleXfs : int
$_escher : \PHPExcel_Shared_Escher
$_firstColumnIndex : int
$_firstRowIndex : int
$_lastColumnIndex : int
$_lastRowIndex : int
(no used rows means -1)
$_parser : \PHPExcel_Writer_Excel5_Parser