46 public static function sizeCol($sheet, $col =
'A')
49 $font = $sheet->getParent()->getDefaultStyle()->getFont();
51 $columnDimensions = $sheet->getColumnDimensions();
54 if ( isset($columnDimensions[$col])
and $columnDimensions[$col]->getWidth() != -1 ) {
57 $columnDimension = $columnDimensions[$col];
58 $width = $columnDimension->getWidth();
61 }
else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
64 $defaultColumnDimension = $sheet->getDefaultColumnDimension();
65 $width = $defaultColumnDimension->getWidth();
75 if (isset($columnDimensions[$col])
and !$columnDimensions[$col]->getVisible()) {
76 $effectivePixelWidth = 0;
78 $effectivePixelWidth = $pixelWidth;
81 return $effectivePixelWidth;
96 $font = $sheet->getParent()->getDefaultStyle()->getFont();
98 $rowDimensions = $sheet->getRowDimensions();
101 if ( isset($rowDimensions[
$row])
and $rowDimensions[$row]->getRowHeight() != -1) {
104 $rowDimension = $rowDimensions[
$row];
105 $rowHeight = $rowDimension->getRowHeight();
106 $pixelRowHeight = (int) ceil(4 * $rowHeight / 3);
108 }
else if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
111 $defaultRowDimension = $sheet->getDefaultRowDimension();
112 $rowHeight = $defaultRowDimension->getRowHeight();
124 if ( isset($rowDimensions[$row])
and !$rowDimensions[$row]->getVisible() ) {
125 $effectivePixelRowHeight = 0;
127 $effectivePixelRowHeight = $pixelRowHeight;
130 return $effectivePixelRowHeight;
151 for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) {
156 $distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024);
159 $distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024));
181 $distanceY += self::sizeRow($sheet,
$row);
185 $distanceY -= (int) floor(self::sizeRow($sheet, $startRow) * $startOffsetY / 256);
188 $distanceY -= (int) floor(self::sizeRow($sheet, $endRow) * (1 - $endOffsetY / 256));
249 $row_start =
$row - 1;
255 $col_end = $col_start;
256 $row_end = $row_start;
262 if ($y1 >= self::sizeRow($sheet, $row_start + 1)) {
266 $width = $width + $x1 -1;
267 $height = $height + $y1 -1;
276 while ($height >= self::sizeRow($sheet, $row_end + 1)) {
277 $height -= self::sizeRow($sheet, $row_end + 1);
289 if (self::sizeRow($sheet, $row_start + 1) == 0) {
292 if (self::sizeRow($sheet, $row_end + 1) == 0) {
298 $y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256;
300 $y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256;
306 'startCoordinates' => $startCoordinates,
307 'startOffsetX' => $x1,
308 'startOffsetY' => $y1,
309 'endCoordinates' => $endCoordinates,
static getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
Get the effective row height for rows without a row dimension or rows with height -1 For example...
static getDistanceX(PHPExcel_Worksheet $sheet, $startColumn='A', $startOffsetX=0, $endColumn='A', $endOffsetX=0)
Get the horizontal distance in pixels between two anchors The distanceX is found as sum of all the sp...
static coordinateFromString($pCoordinateString='A1')
Coordinate from string.
static pointsToPixels($pValue=0)
Convert points to pixels.
static oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height)
Convert 1-cell anchor coordinates to 2-cell anchor coordinates This function is ported from PEAR Spre...
static sizeCol($sheet, $col='A')
Get the width of a column in pixels.
static fontSizeToPixels($fontSizeInPoints=11)
Calculate an (approximate) pixel size, based on a font points size.
Create styles array
The data for the language used.
static sizeRow($sheet, $row=1)
Convert the height of a cell from user's units to pixels.
static columnIndexFromString($pString='A')
Column index from string.
static getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels=false)
Get the effective column width for columns without a column dimension or column with width -1 For exa...
static getDistanceY(PHPExcel_Worksheet $sheet, $startRow=1, $startOffsetY=0, $endRow=1, $endOffsetY=0)
Get the vertical distance in pixels between two anchors The distanceY is found as sum of all the span...
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
static cellDimensionToPixels($pValue=0, PHPExcel_Style_Font $pDefaultFont)
Convert column width from (intrinsic) Excel units to pixels.