Revision of release v1.3.2

This commit is contained in:
CyberPerspectives
2018-07-26 08:33:50 -04:00
committed by Ryan Prather
parent 8c38a6cdb9
commit 750094e3b5
3231 changed files with 133590 additions and 135073 deletions

View File

@ -23,7 +23,7 @@ class Calculation
// Opening bracket
const CALCULATION_REGEXP_OPENBRACE = '\(';
// Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it)
const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\(';
const CALCULATION_REGEXP_FUNCTION = '@?(?:_xlfn\.)?([A-Z][A-Z0-9\.]*)[\s]*\(';
// Cell reference (cell or range of cells, with or without a sheet reference)
const CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})';
// Named Range of cells
@ -1082,6 +1082,13 @@ class Calculation
'functionCall' => [Functions::class, 'isEven'],
'argumentCount' => '1',
],
'ISFORMULA' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isFormula'],
'argumentCount' => '1',
'passCellReference' => true,
'passByReference' => [true],
],
'ISLOGICAL' => [
'category' => Category::CATEGORY_INFORMATION,
'functionCall' => [Functions::class, 'isLogical'],
@ -1302,6 +1309,11 @@ class Calculation
'functionCall' => [Statistical::class, 'MODE'],
'argumentCount' => '1+',
],
'MODE.SNGL' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'MODE'],
'argumentCount' => '1+',
],
'MONTH' => [
'category' => Category::CATEGORY_DATE_AND_TIME,
'functionCall' => [DateTime::class, 'MONTHOFYEAR'],
@ -1700,6 +1712,16 @@ class Calculation
'functionCall' => [Statistical::class, 'STDEV'],
'argumentCount' => '1+',
],
'STDEV.S' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEV'],
'argumentCount' => '1+',
],
'STDEV.P' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEVP'],
'argumentCount' => '1+',
],
'STDEVA' => [
'category' => Category::CATEGORY_STATISTICAL,
'functionCall' => [Statistical::class, 'STDEVA'],
@ -3772,10 +3794,6 @@ class Calculation
$namedRange = $matches[6];
$this->debugLog->writeDebugLog('Evaluating Named Range ', $namedRange);
if (substr($namedRange, 0, 6) === '_xlfn.') {
return $this->raiseFormulaError("undefined named range / function '$token'");
}
$cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false);
$pCell->attach($pCellParent);
$this->debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue));

View File

@ -2,6 +2,8 @@
namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
class Functions
{
const PRECISION = 8.88E-016;
@ -642,4 +644,21 @@ class Functions
return $value;
}
/**
* ISFORMULA.
*
* @param mixed $value The cell to check
* @param Cell $pCell The current cell (containing this formula)
*
* @return bool|string
*/
public static function isFormula($value = '', Cell $pCell = null)
{
if ($pCell === null) {
return self::REF();
}
return substr($pCell->getWorksheet()->getCell($value)->getValue(), 0, 1) === '=';
}
}

View File

@ -1611,14 +1611,10 @@ class Statistical
*
* Returns values along a predicted emponential Trend
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param array of mixed Values of X for which we want to find Y
* @param bool a logical value specifying whether to force the intersect to equal 0
* @param mixed $yValues
* @param mixed $xValues
* @param mixed $newValues
* @param mixed $const
* @param mixed[] $yValues Data Series Y
* @param mixed[] $xValues Data Series X
* @param mixed[] $newValues Values of X for which we want to find Y
* @param bool $const a logical value specifying whether to force the intersect to equal 0
*
* @return array of float
*/
@ -1735,10 +1731,8 @@ class Statistical
*
* Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values.
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param mixed $yValues
* @param mixed $xValues
* @param mixed[] $yValues Data Series Y
* @param mixed[] $xValues Data Series X
*
* @return float
*/
@ -1853,14 +1847,10 @@ class Statistical
* Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data,
* and then returns an array that describes the line.
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param bool a logical value specifying whether to force the intersect to equal 0
* @param bool a logical value specifying whether to return additional regression statistics
* @param mixed $yValues
* @param null|mixed $xValues
* @param mixed $const
* @param mixed $stats
* @param mixed[] $yValues Data Series Y
* @param null|mixed[] $xValues Data Series X
* @param bool $const a logical value specifying whether to force the intersect to equal 0
* @param bool $stats a logical value specifying whether to return additional regression statistics
*
* @return array
*/
@ -1916,14 +1906,10 @@ class Statistical
* Calculates an exponential curve that best fits the X and Y data series,
* and then returns an array that describes the line.
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param bool a logical value specifying whether to force the intersect to equal 0
* @param bool a logical value specifying whether to return additional regression statistics
* @param mixed $yValues
* @param null|mixed $xValues
* @param mixed $const
* @param mixed $stats
* @param mixed[] $yValues Data Series Y
* @param null|mixed[] $xValues Data Series X
* @param bool $const a logical value specifying whether to force the intersect to equal 0
* @param bool $stats a logical value specifying whether to return additional regression statistics
*
* @return array
*/
@ -2592,12 +2578,9 @@ class Statistical
*
* Returns the rank of a value in a data set as a percentage of the data set.
*
* @param array of number An array of, or a reference to, a list of numbers
* @param number the number whose rank you want to find
* @param number the number of significant digits for the returned percentage value
* @param mixed $valueSet
* @param mixed $value
* @param mixed $significance
* @param float[] $valueSet An array of, or a reference to, a list of numbers
* @param int $value the number whose rank you want to find
* @param int $significance the number of significant digits for the returned percentage value
*
* @return float
*/
@ -2747,12 +2730,9 @@ class Statistical
*
* Returns the rank of a number in a list of numbers.
*
* @param number the number whose rank you want to find
* @param array of number An array of, or a reference to, a list of numbers
* @param mixed Order to sort the values in the value set
* @param mixed $value
* @param mixed $valueSet
* @param mixed $order
* @param int $value the number whose rank you want to find
* @param float[] $valueSet An array of, or a reference to, a list of numbers
* @param int $order Order to sort the values in the value set
*
* @return float
*/
@ -2786,10 +2766,8 @@ class Statistical
*
* Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's.
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param mixed $yValues
* @param mixed $xValues
* @param mixed[] $yValues Data Series Y
* @param mixed[] $xValues Data Series X
*
* @return float
*/
@ -2856,10 +2834,8 @@ class Statistical
*
* Returns the slope of the linear regression line through data points in known_y's and known_x's.
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param mixed $yValues
* @param mixed $xValues
* @param mixed[] $yValues Data Series Y
* @param mixed[] $xValues Data Series X
*
* @return float
*/
@ -3160,10 +3136,8 @@ class Statistical
*
* Returns the standard error of the predicted y-value for each x in the regression.
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param mixed $yValues
* @param mixed $xValues
* @param mixed[] $yValues Data Series Y
* @param mixed[] $xValues Data Series X
*
* @return float
*/
@ -3314,14 +3288,10 @@ class Statistical
*
* Returns values along a linear Trend
*
* @param array of mixed Data Series Y
* @param array of mixed Data Series X
* @param array of mixed Values of X for which we want to find Y
* @param bool a logical value specifying whether to force the intersect to equal 0
* @param mixed $yValues
* @param mixed $xValues
* @param mixed $newValues
* @param mixed $const
* @param mixed[] $yValues Data Series Y
* @param mixed[] $xValues Data Series X
* @param mixed[] $newValues Values of X for which we want to find Y
* @param bool $const a logical value specifying whether to force the intersect to equal 0
*
* @return array of float
*/

View File

@ -308,7 +308,7 @@ class Cell
* Get old calculated value (cached)
* This returns the value last calculated by MS Excel or whichever spreadsheet program was used to
* create the original spreadsheet file.
* Note that this value is not guaranteed to refelect the actual calculated value because it is
* Note that this value is not guaranteed to reflect the actual calculated value because it is
* possible that auto-calculation was disabled in the original spreadsheet, and underlying data
* values used by the formula have changed since it was last calculated.
*

View File

@ -127,9 +127,9 @@ abstract class Coordinate
*
* @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4'
*
* @return array Array containg one or more arrays containing one or two coordinate strings
* e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11'))
* or array('B4')
* @return array Array containing one or more arrays containing one or two coordinate strings
* e.g. ['B4','D9'] or [['B4','D9'], ['H2','O11']]
* or ['B4']
*/
public static function splitRange($pRange)
{
@ -179,7 +179,7 @@ abstract class Coordinate
*
* @param string $pRange Cell range (e.g. A1:A1)
*
* @return array Range coordinates array(Start Cell, End Cell)
* @return array Range coordinates [Start Cell, End Cell]
* where Start Cell and End Cell are arrays (Column Number, Row Number)
*/
public static function rangeBoundaries($pRange)
@ -230,8 +230,8 @@ abstract class Coordinate
*
* @param string $pRange Cell range (e.g. A1:A1)
*
* @return array Range coordinates array(Start Cell, End Cell)
* where Start Cell and End Cell are arrays (Column ID, Row Number)
* @return array Range coordinates [Start Cell, End Cell]
* where Start Cell and End Cell are arrays [Column ID, Row Number]
*/
public static function getRangeBoundaries($pRange)
{

View File

@ -285,7 +285,7 @@ class Cells
*/
private function getUniqueID()
{
return uniqid('phpspreadsheet-', true) . '-';
return uniqid('phpspreadsheet.', true) . '.';
}
/**

View File

@ -476,6 +476,13 @@ class Csv extends BaseReader
fclose($this->fileHandle);
return true;
$type = mime_content_type($pFilename);
$supportedTypes = [
'text/csv',
'text/plain',
'inode/x-empty',
];
return in_array($type, $supportedTypes, true);
}
}

View File

@ -612,9 +612,9 @@ class Html extends BaseReader
* - Implement to other propertie, such as border
*
* @param Worksheet $sheet
* @param array $attributeArray
* @param int $row
* @param string $column
* @param array $attributeArray
*/
private function applyInlineStyle(&$sheet, $row, $column, $attributeArray)
{

View File

@ -7522,7 +7522,7 @@ class Xls extends BaseReader
/**
* read BIFF8 constant value array from array data
* returns e.g. array('value' => '{1,2;3,4}', 'size' => 40}
* returns e.g. ['value' => '{1,2;3,4}', 'size' => 40]
* section 2.5.8.
*
* @param string $arrayData
@ -7562,7 +7562,7 @@ class Xls extends BaseReader
/**
* read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
* section 2.5.7
* returns e.g. array('value' => '5', 'size' => 9).
* returns e.g. ['value' => '5', 'size' => 9].
*
* @param string $valueData
*

View File

@ -13,7 +13,7 @@ class Color
* @param array $palette Color palette
* @param int $version
*
* @return array RGB color value, example: array('rgb' => 'FF0000')
* @return array RGB color value, example: ['rgb' => 'FF0000']
*/
public static function map($color, $palette, $version)
{

View File

@ -702,10 +702,24 @@ class Xlsx extends BaseReader
if (isset($xmlSheet->sheetViews, $xmlSheet->sheetViews->sheetView)) {
if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
$docSheet->getSheetView()->setZoomScale((int) ($xmlSheet->sheetViews->sheetView['zoomScale']));
$zoomScale = (int) ($xmlSheet->sheetViews->sheetView['zoomScale']);
if ($zoomScale <= 0) {
// setZoomScale will throw an Exception if the scale is less than or equals 0
// that is OK when manually creating documents, but we should be able to read all documents
$zoomScale = 100;
}
$docSheet->getSheetView()->setZoomScale($zoomScale);
}
if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) {
$docSheet->getSheetView()->setZoomScaleNormal((int) ($xmlSheet->sheetViews->sheetView['zoomScaleNormal']));
$zoomScaleNormal = (int) ($xmlSheet->sheetViews->sheetView['zoomScaleNormal']);
if ($zoomScaleNormal <= 0) {
// setZoomScaleNormal will throw an Exception if the scale is less than or equals 0
// that is OK when manually creating documents, but we should be able to read all documents
$zoomScaleNormal = 100;
}
$docSheet->getSheetView()->setZoomScaleNormal($zoomScaleNormal);
}
if (isset($xmlSheet->sheetViews->sheetView['view'])) {
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
@ -1686,7 +1700,7 @@ class Xlsx extends BaseReader
}
// Some definedNames are only applicable if we are on the same sheet...
if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $sheetId) {
if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $oldSheetId) {
// Switch on type
switch ((string) $definedName['name']) {
case '_xlnm._FilterDatabase':
@ -2055,7 +2069,7 @@ class Xlsx extends BaseReader
if (is_object($is->r)) {
foreach ($is->r as $run) {
if (!isset($run->rPr)) {
$objText = $value->createText(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
$value->createText(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
} else {
$objText = $value->createTextRun(StringHelper::controlCharacterOOXML2PHP((string) $run->t));
@ -2063,7 +2077,7 @@ class Xlsx extends BaseReader
$objText->getFont()->setName((string) $run->rPr->rFont['val']);
}
if (isset($run->rPr->sz['val'])) {
$objText->getFont()->setSize((string) $run->rPr->sz['val']);
$objText->getFont()->setSize((float) $run->rPr->sz['val']);
}
if (isset($run->rPr->color)) {
$objText->getFont()->setColor(new Color(self::readColor($run->rPr->color)));
@ -2125,7 +2139,7 @@ class Xlsx extends BaseReader
'SimpleXMLElement',
Settings::getLibXmlLoaderOptions()
);
if ($UIRels) {
if (false !== $UIRels) {
// we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image
foreach ($UIRels->Relationship as $ele) {
if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') {
@ -2141,11 +2155,11 @@ class Xlsx extends BaseReader
if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) {
$excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries);
} else {
$excel->setRibbonBinObjects(null);
$excel->setRibbonBinObjects(null, null);
}
} else {
$excel->setRibbonXMLData(null);
$excel->setRibbonBinObjects(null);
$excel->setRibbonXMLData(null, null);
$excel->setRibbonBinObjects(null, null);
}
}

View File

@ -474,7 +474,7 @@ class Date
}
/**
* Strips an ordinal froma numeric value.
* Strips an ordinal from a numeric value.
*
* @param string $day Day number with an ordinal
*

View File

@ -164,7 +164,7 @@ class DggContainer
}
/**
* Set identifier clusters. array(<drawingId> => <max shape id>, ...).
* Set identifier clusters. [<drawingId> => <max shape id>, ...].
*
* @param array $pValue
*/

View File

@ -124,16 +124,17 @@ class Alignment extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(
* array(
* 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
* 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
* 'textRotation' => 0,
* 'wrapText' => TRUE
* )
* [
* 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
* 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
* 'textRotation' => 0,
* 'wrapText' => TRUE
* ]
* );
* </code>.
* </code>
*
* @param array $pStyles Array containing style information
*

View File

@ -114,12 +114,12 @@ class Border extends Supervisor
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray(
* array(
* [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array(
* 'color' => [
* 'rgb' => '808080'
* )
* )
* ]
* ]
* );
* </code>
*

View File

@ -160,36 +160,38 @@ class Borders extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* array(
* 'bottom' => array(
* [
* 'bottom' => [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array(
* 'color' => [
* 'rgb' => '808080'
* )
* ),
* 'top' => array(
* ]
* ],
* 'top' => [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array(
* 'color' => [
* 'rgb' => '808080'
* )
* )
* )
* ]
* ]
* ]
* );
* </code>
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
* array(
* 'allBorders' => array(
* [
* 'allBorders' => [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array(
* 'color' => [
* 'rgb' => '808080'
* )
* )
* )
* ]
* ]
* ]
* );
* </code>.
* </code>
*
* @param array $pStyles Array containing style information
*

View File

@ -86,9 +86,10 @@ class Color extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') );
* </code>.
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray(['rgb' => '808080']);
* </code>
*
* @param array $pStyles Array containing style information
*

View File

@ -121,20 +121,21 @@ class Fill extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
* array(
* 'fillType' => Fill::FILL_GRADIENT_LINEAR,
* 'rotation' => 0,
* 'startColor' => array(
* 'rgb' => '000000'
* ),
* 'endColor' => array(
* 'argb' => 'FFFFFFFF'
* )
* )
* [
* 'fillType' => Fill::FILL_GRADIENT_LINEAR,
* 'rotation' => 0,
* 'startColor' => [
* 'rgb' => '000000'
* ],
* 'endColor' => [
* 'argb' => 'FFFFFFFF'
* ]
* ]
* );
* </code>.
* </code>
*
* @param array $pStyles Array containing style information
*

View File

@ -141,20 +141,21 @@ class Font extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
* array(
* 'name' => 'Arial',
* 'bold' => TRUE,
* 'italic' => FALSE,
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
* 'strikethrough' => FALSE,
* 'color' => array(
* 'rgb' => '808080'
* )
* )
* [
* 'name' => 'Arial',
* 'bold' => TRUE,
* 'italic' => FALSE,
* 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
* 'strikethrough' => FALSE,
* 'color' => [
* 'rgb' => '808080'
* ]
* ]
* );
* </code>.
* </code>
*
* @param array $pStyles Array containing style information
*
@ -483,8 +484,9 @@ class Font extends Supervisor
if ($pValue == '') {
$pValue = false;
}
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['strike' => $pValue]);
$styleArray = $this->getStyleArray(['strikethrough' => $pValue]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->strikethrough = $pValue;

View File

@ -47,7 +47,8 @@ class NumberFormat extends Supervisor
const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-';
const FORMAT_CURRENCY_USD = '$#,##0_-';
const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-';
const FORMAT_CURRENCY_EUR_SIMPLE = '#,##0.00_-"€"';
const FORMAT_CURRENCY_EUR = '#,##0_-"€"';
/**
* Excel built-in number formats.
@ -123,13 +124,14 @@ class NumberFormat extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
* array(
* 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
* )
* [
* 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
* ]
* );
* </code>.
* </code>
*
* @param array $pStyles Array containing style information
*

View File

@ -72,14 +72,15 @@ class Protection extends Supervisor
/**
* Apply styles from array.
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
* array(
* 'locked' => TRUE,
* 'hidden' => FALSE
* )
* [
* 'locked' => TRUE,
* 'hidden' => FALSE
* ]
* );
* </code>.
* </code>
*
* @param array $pStyles Array containing style information
*

View File

@ -151,33 +151,33 @@ class Style extends Supervisor
*
* <code>
* $spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray(
* array(
* 'font' => array(
* 'name' => 'Arial',
* 'bold' => true,
* 'italic' => false,
* 'underline' => Font::UNDERLINE_DOUBLE,
* 'strikethrough' => false,
* 'color' => array(
* [
* 'font' => [
* 'name' => 'Arial',
* 'bold' => true,
* 'italic' => false,
* 'underline' => Font::UNDERLINE_DOUBLE,
* 'strikethrough' => false,
* 'color' => [
* 'rgb' => '808080'
* ]
* ],
* 'borders' => [
* 'bottom' => [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => [
* 'rgb' => '808080'
* )
* ),
* 'borders' => array(
* 'bottom' => array(
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array(
* 'rgb' => '808080'
* )
* ),
* 'top' => array(
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => array(
* 'rgb' => '808080'
* )
* )
* ),
* 'quotePrefix' => true
* )
* ]
* ],
* 'top' => [
* 'borderStyle' => Border::BORDER_DASHDOT,
* 'color' => [
* 'rgb' => '808080'
* ]
* ]
* ],
* 'quotePrefix' => true
* ]
* );
* </code>
*

View File

@ -365,12 +365,13 @@ class BaseDrawing implements IComparable
}
/**
* Set width and height with proportional resize
* Set width and height with proportional resize.
*
* Example:
* <code>
* $objDrawing->setResizeProportional(true);
* $objDrawing->setWidthAndHeight(160,120);
* </code>.
* </code>
*
* @author Vincent@luo MSN:kele_100@hotmail.com
*

View File

@ -1971,7 +1971,7 @@ class Worksheet implements IComparable
*
* - A2 will freeze the rows above cell A2 (i.e row 1)
* - B1 will freeze the columns to the left of cell B1 (i.e column A)
* - B2 will freeze the rows above and to the left of cell A2 (i.e row 1 and column A)
* - B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A)
*
* @param null|string $cell Position of the split
* @param null|string $topLeftCell default position of the right bottom pane
@ -1988,7 +1988,7 @@ class Worksheet implements IComparable
if ($cell !== null && $topLeftCell === null) {
$coordinate = Coordinate::coordinateFromString($cell);
$topLeftCell = $coordinate[0] . ($coordinate[1] + 1);
$topLeftCell = $coordinate[0] . $coordinate[1];
}
$this->freezePane = $cell;
@ -2712,7 +2712,7 @@ class Worksheet implements IComparable
* Extract worksheet title from range.
*
* Example: extractSheetTitle("testSheet!A1") ==> 'A1'
* Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1');
* Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1'];
*
* @param string $pRange Range to extract title from
* @param bool $returnRange Return range? (see example)

View File

@ -352,10 +352,10 @@ class Html extends BaseWriter
// Construct HTML
$properties = $this->spreadsheet->getProperties();
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . PHP_EOL;
$html .= '<!-- Generated by Spreadsheet - https://github.com/PHPOffice/Spreadsheet -->' . PHP_EOL;
$html .= '<html>' . PHP_EOL;
$html .= ' <head>' . PHP_EOL;
$html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . PHP_EOL;
$html .= ' <meta name="generator" content="PhpSpreadsheet, https://github.com/PHPOffice/PhpSpreadsheet">' . PHP_EOL;
if ($properties->getTitle() > '') {
$html .= ' <title>' . htmlspecialchars($properties->getTitle()) . '</title>' . PHP_EOL;
}

View File

@ -563,7 +563,7 @@ class Parser
private function convertString($string)
{
// chop away beggining and ending quotes
$string = substr($string, 1, -2);
$string = substr($string, 1, -1);
if (strlen($string) > 255) {
throw new WriterException('String is too long');
}

View File

@ -552,8 +552,8 @@ class Worksheet extends BIFFwriter
$lastCell = $explodes[1];
}
$firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. array(0, 1)
$lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. array(1, 6)
$firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. [0, 1]
$lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. [1, 6]
return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, Coordinate::columnIndexFromString($firstCellCoordinates[0]) - 1, Coordinate::columnIndexFromString($lastCellCoordinates[0]) - 1);
}

View File

@ -1054,6 +1054,8 @@ class Worksheet extends WriterPart
$pCell->getCalculatedValue() : $cellValue;
if (is_string($calculatedValue)) {
$objWriter->writeAttribute('t', 'str');
} elseif (is_bool($calculatedValue)) {
$objWriter->writeAttribute('t', 'b');
}
break;