You are here

public static function PHPExcel_Shared_Excel5::sizeRow in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Excel5.php \PHPExcel_Shared_Excel5::sizeRow()

* Convert the height of a cell from user's units to pixels. 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. * *

Parameters

PHPExcel_Worksheet $sheet The sheet: * @param integer $row The row index (1-based) * @return integer The width in pixels

4 calls to PHPExcel_Shared_Excel5::sizeRow()
PHPExcel_Reader_Excel5::load in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Loads PHPExcel from file * *
PHPExcel_Shared_Excel5::getDistanceY in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Excel5.php
* Get the vertical distance in pixels between two anchors * The distanceY is found as sum of all the spanning rows minus two offsets * *
PHPExcel_Shared_Excel5::oneAnchor2twoAnchor in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Excel5.php
* Convert 1-cell anchor coordinates to 2-cell anchor coordinates * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications * * Calculate the vertices that define the position of the image as required by * the OBJ…
PHPExcel_Writer_Excel5_Worksheet::_positionImage in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php
* Calculate the vertices that define the position of the image as required by * the OBJ record. * * +------------+------------+ * | A | B | * +-----+------------+------------+ * | |(x1,y1) | | * | 1 …

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Excel5.php, line 93

Class

PHPExcel_Shared_Excel5
PHPExcel_Shared_Excel5

Code

public static function sizeRow($sheet, $row = 1) {

  // default font of the workbook
  $font = $sheet
    ->getParent()
    ->getDefaultStyle()
    ->getFont();
  $rowDimensions = $sheet
    ->getRowDimensions();

  // first find the true row height in pixels (uncollapsed and unhidden)
  if (isset($rowDimensions[$row]) and $rowDimensions[$row]
    ->getRowHeight() != -1) {

    // then we have a row dimension
    $rowDimension = $rowDimensions[$row];
    $rowHeight = $rowDimension
      ->getRowHeight();
    $pixelRowHeight = (int) ceil(4 * $rowHeight / 3);

    // here we assume Arial 10
  }
  else {
    if ($sheet
      ->getDefaultRowDimension()
      ->getRowHeight() != -1) {

      // then we have a default row dimension with explicit height
      $defaultRowDimension = $sheet
        ->getDefaultRowDimension();
      $rowHeight = $defaultRowDimension
        ->getRowHeight();
      $pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
    }
    else {

      // we don't even have any default row dimension. Height depends on default font
      $pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
      $pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
    }
  }

  // now find the effective row height in pixels
  if (isset($rowDimensions[$row]) and !$rowDimensions[$row]
    ->getVisible()) {
    $effectivePixelRowHeight = 0;
  }
  else {
    $effectivePixelRowHeight = $pixelRowHeight;
  }
  return $effectivePixelRowHeight;
}