You are here

public function PHPExcel_Worksheet_HeaderFooterDrawing::setWidthAndHeight in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php \PHPExcel_Worksheet_HeaderFooterDrawing::setWidthAndHeight()

Set width and height with proportional resize * Example: * <code> $objDrawing->setResizeProportional(true); $objDrawing->setWidthAndHeight(160,120); * </code> * @author Vincent@luo MSN:kele_100@hotmail.com

Parameters

int $width:

int $height:

Return value

PHPExcel_Worksheet_HeaderFooterDrawing

Overrides PHPExcel_Worksheet_BaseDrawing::setWidthAndHeight

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php, line 231

Class

PHPExcel_Worksheet_HeaderFooterDrawing
PHPExcel_Worksheet_HeaderFooterDrawing

Code

public function setWidthAndHeight($width = 0, $height = 0) {
  $xratio = $width / $this->_width;
  $yratio = $height / $this->_height;
  if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
    if ($xratio * $this->_height < $height) {
      $this->_height = ceil($xratio * $this->_height);
      $this->_width = $width;
    }
    else {
      $this->_width = ceil($yratio * $this->_width);
      $this->_height = $height;
    }
  }
  return $this;
}