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
mixed
The formula parser created for the Workbook
boolean
Flag 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() |
string
The original binary data to be written
string
A very convenient string of continue blocks_append(string $data)
access | private |
---|---|
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_append() |
string
binary 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 |
---|
integer
Col containing upper left corner of object
integer
Row containing top left corner of object
integer
Distance to left side of object
integer
Distance to top of object
integer
Width of image frame
integer
Height of image frame
_processBitmap(string $bitmap) : array
This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the MSDN library.
access | private |
---|
string
The bitmap to process
array
Array with data and properties of the bitmap_processBitmapGd(resource $image) : array
access | private |
---|
resource
The image to process
array
Array with data and properties of the bitmap_storeBof(integer $type)
access | private |
---|---|
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::_storeBof() |
integer
Type 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
integer
Zero indexed row
integer
Zero indexed column
mixed
The 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() |
integer
Start row
integer
Start column
integer
End row
integer
End column
string
URL string
integer
_writeUrlInternal(integer $row1, integer $col1, integer $row2, integer $col2, string $url) : integer
access | private |
---|---|
see | \_writeUrl() |
integer
Start row
integer
Start column
integer
End row
integer
End column
string
URL 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() |
integer
Start row
integer
Start column
integer
End row
integer
End column
string
URL 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() |
integer
Start row
integer
Start column
integer
End row
integer
End column
string
URL string
integer
close()
access | public |
---|---|
see | \PHPExcel_Writer_Excel5_Workbook::storeWorkbook() |
getByteOrder() : int
inherited_from | \PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder() |
---|
int
getData() : string
string
The datainsertBitmap(integer $row, integer $col, mixed $bitmap, integer $x, integer $y, float $scale_x, float $scale_y)
access | public |
---|
integer
The row we are going to insert the bitmap into
integer
The column we are going to insert the bitmap into
mixed
The bitmap filename or GD-image resource
integer
The horizontal position (offset) of the image inside the cell.
integer
The vertical position (offset) of the image inside the cell.
float
The horizontal scale
float
The vertical scale
printRowColHeaders(integer $print)
access | public |
---|
integer
Whether 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() |
---|
string
binary data to write
string
writeEof()
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
string
E.g. 'A1' or 'A1:B6'
string
Binary data_writeBoolErr(int $row, int $col, int $value, boolean $isError, int $xfIndex)
int
Row index (0-based)
int
Column index (0-based)
int
boolean
Error 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.
array
This 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.
integer
The 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.
string
The 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
integer
Zero indexed row
integer
Zero indexed column
string
The formula text string
mixed
The XF format index
mixed
Calculated 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 |
---|
integer
Zero indexed row
integer
Zero indexed column
string
The string to write
mixed
The 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 |
---|
integer
Zero indexed row
integer
Zero indexed column
string
The string to write
mixed
The 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.
integer
Zero indexed row
integer
Zero indexed column
string
The 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
integer
Zero indexed row
integer
Zero indexed column
float
The number to write
mixed
The 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.
integer
Column containing upper left corner of object
integer
Distance from left side of cell
integer
Row containing top left corner of object
integer
Distance from top of cell
integer
Column containing lower right corner of object
integer
Distance from right of cell
integer
Row containing bottom right corner of object
integer
Distance 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.
int
Row index (0-based)
int
Column index (0-based)
string
The string
mixed
The XF format index for the cell
array
Index to Font record and characters beginning
_writeRow(integer $row, integer $height, integer $xfIndex, bool $hidden, integer $level)
integer
The row to set
integer
Height we are giving to the row. Use null to set XF without setting height
integer
The optional cell style Xf index to apply to the columns
bool
The optional hidden attribute
integer
The 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
int
Row index (0-based)
int
Column index (0-based)
string
The string
int
Index 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
integer
Row
integer
Column
string
URL 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