public function PHPExcel_Worksheet_BaseDrawing::setWidthAndHeight in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/BaseDrawing.php \PHPExcel_Worksheet_BaseDrawing::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_BaseDrawing
1 method overrides PHPExcel_Worksheet_BaseDrawing::setWidthAndHeight()
- PHPExcel_Worksheet_HeaderFooterDrawing::setWidthAndHeight in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Worksheet/ HeaderFooterDrawing.php - 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
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Worksheet/ BaseDrawing.php, line 375
Class
- PHPExcel_Worksheet_BaseDrawing
- PHPExcel_Worksheet_BaseDrawing
Code
public function setWidthAndHeight($width = 0, $height = 0) {
$xratio = $width / ($this->_width != 0 ? $this->_width : 1);
$yratio = $height / ($this->_height != 0 ? $this->_height : 1);
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;
}
}
else {
$this->_width = $width;
$this->_height = $height;
}
return $this;
}