PHPExcel_Shared_Excel5
category | PHPExcel |
---|---|
package | PHPExcel_Shared |
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
getDistanceX(\PHPExcel_Worksheet $sheet, string $startColumn, integer $startOffsetX, string $endColumn, integer $endOffsetX) : integer
\PHPExcel_Worksheet
string
integer
Offset within start cell measured in 1/1024 of the cell width
string
integer
Offset within end cell measured in 1/1024 of the cell width
integer
Horizontal measured in pixelsgetDistanceY(\PHPExcel_Worksheet $sheet, integer $startRow, integer $startOffsetY, integer $endRow, integer $endOffsetY) : integer
\PHPExcel_Worksheet
integer
(1-based)
integer
Offset within start cell measured in 1/256 of the cell height
integer
(1-based)
integer
Offset within end cell measured in 1/256 of the cell height
integer
Vertical distance measured in pixelsoneAnchor2twoAnchor(\PHPExcel_Worksheet $sheet, string $coordinates, integer $offsetX, integer $offsetY, integer $width, integer $height) : array
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
\PHPExcel_Worksheet
string
E.g. 'A1'
integer
Horizontal offset in pixels
integer
Vertical offset in pixels
integer
Width in pixels
integer
Height in pixels
array
sizeCol(\PHPExcel_Worksheet $sheet, string $col) : integer
We use the relationship y = ceil(7x) where x is the width in intrinsic Excel units (measuring width in number of normal characters) This holds for Arial 10
string
The column
integer
The width in pixelssizeRow(\PHPExcel_Worksheet $sheet, integer $row) : integer
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.
integer
The row index (1-based)
integer
The width in pixels