You are here

public static function PHPExcel_Shared_Excel5::getDistanceX 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::getDistanceX()

* Get the horizontal distance in pixels between two anchors * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets * *

Parameters

PHPExcel_Worksheet $sheet: * @param string $startColumn * @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width * @param string $endColumn * @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width * @return integer Horizontal measured in pixels

1 call to PHPExcel_Shared_Excel5::getDistanceX()
PHPExcel_Reader_Excel5::load in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Loads PHPExcel from file * *

File

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

Class

PHPExcel_Shared_Excel5
PHPExcel_Shared_Excel5

Code

public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) {
  $distanceX = 0;

  // add the widths of the spanning columns
  $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;

  // 1-based
  $endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;

  // 1-based
  for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) {
    $distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i));
  }

  // correct for offsetX in startcell
  $distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024);

  // correct for offsetX in endcell
  $distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024));
  return $distanceX;
}