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));
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)) {
289 if (self::sizeRow($sheet, $row_start + 1) == 0) {
292 if (self::sizeRow($sheet, $row_end + 1) == 0) {
300 $y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256;
306 'startCoordinates' => $startCoordinates,
307 'startOffsetX' => $x1,
308 'startOffsetY' => $y1,
309 'endCoordinates' => $endCoordinates,