23 if ($value === null) {
24 return parent::bindValue($cell, $value);
25 } elseif (is_string($value)) {
31 $dataType = parent::dataTypeForValue($value);
47 if (preg_match(
'/^([+-]?)\s*(\d+)\s?\/\s*(\d+)$/', $value, $matches)) {
49 } elseif (preg_match(
'/^([+-]?)(\d*) +(\d*)\s?\/\s*(\d*)$/', $value, $matches)) {
54 if (preg_match(
'/^\-?\d*\.?\d*\s?\%$/', $value)) {
62 if (preg_match(
'/^' . preg_quote($currencyCode,
'/') .
' *(\d{1,3}(' . preg_quote($thousandsSeparator,
'/') .
'\d{3})*|(\d+))(' . preg_quote($decimalSeparator,
'/') .
'\d{2})?$/', $value)) {
64 $value = (float) trim(str_replace([$currencyCode, $thousandsSeparator, $decimalSeparator], [
'',
'',
'.'], $value));
68 ->getNumberFormat()->setFormatCode(
73 } elseif (preg_match(
'/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
75 $value = (float) trim(str_replace([
'$',
','],
'', $value));
85 if (preg_match(
'/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
90 if (preg_match(
'/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
99 if (strpos($value,
':') !==
false) {
100 $formatCode =
'yyyy-mm-dd h:mm';
102 $formatCode =
'yyyy-mm-dd';
105 ->getNumberFormat()->setFormatCode($formatCode);
111 if (strpos($value,
"\n") !==
false) {
115 ->getAlignment()->setWrapText(
true);
122 return parent::bindValue($cell, $value);
128 $value = $matches[2] + ($matches[3] / $matches[4]);
129 if ($matches[1] ===
'-') {
135 $dividend = str_repeat(
'?', strlen($matches[3]));
136 $divisor = str_repeat(
'?', strlen($matches[4]));
137 $fractionMask =
"# {$dividend}/{$divisor}";
140 ->getNumberFormat()->setFormatCode($fractionMask);
148 $value = $matches[2] / $matches[3];
149 if ($matches[1] ===
'-') {
155 $dividend = str_repeat(
'?', strlen($matches[2]));
156 $divisor = str_repeat(
'?', strlen($matches[3]));
157 $fractionMask =
"{$dividend}/{$divisor}";
160 ->getNumberFormat()->setFormatCode($fractionMask);
168 $value = ((float) str_replace(
'%',
'', $value)) / 100;
181 [$hours, $minutes] = explode(
':', $value);
182 $days = ($hours / 24) + ($minutes / 1440);
195 [$hours, $minutes, $seconds] = explode(
':', $value);
196 $days = ($hours / 24) + ($minutes / 1440) + ($seconds / 86400);
setValueExplicit($pValue, $pDataType)
Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the ...
static sanitizeUTF8($value)
Try to sanitize UTF8, stripping invalid byte sequences.
getCoordinate()
Get cell coordinate.
static getCurrencyCode()
Get the currency code.
static getFALSE()
Return the locale-specific translation of FALSE.
setTimeHoursMinutesSeconds(string $value, Cell $cell)
bindValue(Cell $cell, $value=null)
Bind value to a cell.
static getTRUE()
Return the locale-specific translation of TRUE.
setTimeHoursMinutes(string $value, Cell $cell)
setProperFraction(array $matches, Cell $cell)
static stringToExcel($dateValue)
Convert a date/time string to Excel time.
static getThousandsSeparator()
Get the thousands separator.
static getDecimalSeparator()
Get the decimal separator.
setPercentage(string $value, Cell $cell)
getWorksheet()
Get parent worksheet.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
setImproperFraction(array $matches, Cell $cell)