Additional divide by zero handling
This commit is contained in:
parent
311d03b4c3
commit
c6d0a4d3d0
|
@ -321,7 +321,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
public function setWidth($pValue = 0) {
|
public function setWidth($pValue = 0) {
|
||||||
// Resize proportional?
|
// Resize proportional?
|
||||||
if ($this->_resizeProportional && $pValue != 0) {
|
if ($this->_resizeProportional && $pValue != 0) {
|
||||||
$ratio = $this->_height / $this->_width;
|
$ratio = $this->_height / ($this->_width !== 0 ? $this->_width : 1);
|
||||||
$this->_height = round($ratio * $pValue);
|
$this->_height = round($ratio * $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,8 +373,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
* @return PHPExcel_Worksheet_BaseDrawing
|
* @return PHPExcel_Worksheet_BaseDrawing
|
||||||
*/
|
*/
|
||||||
public function setWidthAndHeight($width = 0, $height = 0) {
|
public function setWidthAndHeight($width = 0, $height = 0) {
|
||||||
$xratio = $width / $this->_width;
|
$xratio = $width / ($this->_width !== 0 ? $this->_width : 1);
|
||||||
$yratio = $height / $this->_height;
|
$yratio = $height / ($this->_height !== 0 ? $this->_height : 1);
|
||||||
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
|
||||||
if (($xratio * $this->_height) < $height) {
|
if (($xratio * $this->_height) < $height) {
|
||||||
$this->_height = ceil($xratio * $this->_height);
|
$this->_height = ceil($xratio * $this->_height);
|
||||||
|
@ -383,7 +383,11 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
$this->_width = ceil($yratio * $this->_width);
|
$this->_width = ceil($yratio * $this->_width);
|
||||||
$this->_height = $height;
|
$this->_height = $height;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
$this->_width = $width;
|
||||||
|
$this->_height = $height;
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,11 @@
|
||||||
|
|
||||||
Planned for v1.8.1
|
Planned for v1.8.1
|
||||||
- Bugfix: (goncons) Work Item GH-397 - Fix for Writing an Open Document cell with non-numeric formula
|
- Bugfix: (goncons) Work Item GH-397 - Fix for Writing an Open Document cell with non-numeric formula
|
||||||
|
- Bugfix: (sarciszewski) Work Item GH-329 - Avoid potential divide by zero in basedrawing
|
||||||
|
- General: (MBaker) - Small performance improvement for autosize columns
|
||||||
- Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines
|
- Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines
|
||||||
- Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell
|
- Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell
|
||||||
|
- Feature: (CQD) Work Item GH-389 - Additional Mac CJK codepage definitions
|
||||||
|
|
||||||
|
|
||||||
2014-03-02 (v1.8.0):
|
2014-03-02 (v1.8.0):
|
||||||
|
|
Loading…
Reference in New Issue