#401 : PHPCS (Shared\StringHelper)
This commit is contained in:
		
							parent
							
								
									c0fe7c275d
								
							
						
					
					
						commit
						69e168271a
					
				@ -3929,7 +3929,7 @@ class Calculation
 | 
				
			|||||||
                    $stack->push('Value', $operand);
 | 
					                    $stack->push('Value', $operand);
 | 
				
			||||||
                    $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
 | 
					                    $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
 | 
				
			||||||
                    return false;
 | 
					                    return false;
 | 
				
			||||||
                } elseif (!Shared\String::convertToNumberIfFraction($operand)) {
 | 
					                } elseif (!Shared\StringHelper::convertToNumberIfFraction($operand)) {
 | 
				
			||||||
                    //    If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
 | 
					                    //    If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations
 | 
				
			||||||
                    $stack->push('Value', '#VALUE!');
 | 
					                    $stack->push('Value', '#VALUE!');
 | 
				
			||||||
                    $this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
 | 
					                    $this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!'));
 | 
				
			||||||
@ -4071,8 +4071,8 @@ class Calculation
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private function strcmpLowercaseFirst($str1, $str2)
 | 
					    private function strcmpLowercaseFirst($str1, $str2)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $inversedStr1 = Shared\String::StrCaseReverse($str1);
 | 
					        $inversedStr1 = Shared\StringHelper::strCaseReverse($str1);
 | 
				
			||||||
        $inversedStr2 = Shared\String::StrCaseReverse($str2);
 | 
					        $inversedStr2 = Shared\StringHelper::strCaseReverse($str2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return strcmp($inversedStr1, $inversedStr2);
 | 
					        return strcmp($inversedStr1, $inversedStr2);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -238,8 +238,8 @@ class TextData
 | 
				
			|||||||
                $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
					                $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (($offset > 0) && (\PHPExcel\Shared\StringHelper::CountCharacters($haystack) > $offset)) {
 | 
					            if (($offset > 0) && (\PHPExcel\Shared\StringHelper::countCharacters($haystack) > $offset)) {
 | 
				
			||||||
                if (\PHPExcel\Shared\StringHelper::CountCharacters($needle) == 0) {
 | 
					                if (\PHPExcel\Shared\StringHelper::countCharacters($needle) == 0) {
 | 
				
			||||||
                    return $offset;
 | 
					                    return $offset;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (function_exists('mb_strpos')) {
 | 
					                if (function_exists('mb_strpos')) {
 | 
				
			||||||
@ -275,8 +275,8 @@ class TextData
 | 
				
			|||||||
                $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
					                $haystack = ($haystack) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (($offset > 0) && (\PHPExcel\Shared\StringHelper::CountCharacters($haystack) > $offset)) {
 | 
					            if (($offset > 0) && (\PHPExcel\Shared\StringHelper::countCharacters($haystack) > $offset)) {
 | 
				
			||||||
                if (\PHPExcel\Shared\StringHelper::CountCharacters($needle) == 0) {
 | 
					                if (\PHPExcel\Shared\StringHelper::countCharacters($needle) == 0) {
 | 
				
			||||||
                    return $offset;
 | 
					                    return $offset;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (function_exists('mb_stripos')) {
 | 
					                if (function_exists('mb_stripos')) {
 | 
				
			||||||
@ -449,7 +449,7 @@ class TextData
 | 
				
			|||||||
            $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
					            $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return \PHPExcel\Shared\StringHelper::StrToLower($mixedCaseString);
 | 
					        return \PHPExcel\Shared\StringHelper::strToLower($mixedCaseString);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -469,7 +469,7 @@ class TextData
 | 
				
			|||||||
            $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
					            $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return \PHPExcel\Shared\StringHelper::StrToUpper($mixedCaseString);
 | 
					        return \PHPExcel\Shared\StringHelper::strToUpper($mixedCaseString);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -489,7 +489,7 @@ class TextData
 | 
				
			|||||||
            $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
					            $mixedCaseString = ($mixedCaseString) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return \PHPExcel\Shared\StringHelper::StrToTitle($mixedCaseString);
 | 
					        return \PHPExcel\Shared\StringHelper::strToTitle($mixedCaseString);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        // sanitize UTF-8 strings
 | 
					        // sanitize UTF-8 strings
 | 
				
			||||||
        if (is_string($value)) {
 | 
					        if (is_string($value)) {
 | 
				
			||||||
            $value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
 | 
					            $value = \PHPExcel\Shared\StringHelper::sanitizeUTF8($value);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Find out data type
 | 
					        // Find out data type
 | 
				
			||||||
@ -165,7 +165,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // Check for newline character "\n"
 | 
					            // Check for newline character "\n"
 | 
				
			||||||
            if (strpos($value, "\n") !== false) {
 | 
					            if (strpos($value, "\n") !== false) {
 | 
				
			||||||
                $value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
 | 
					                $value = \PHPExcel\Shared\StringHelper::sanitizeUTF8($value);
 | 
				
			||||||
                $cell->setValueExplicit($value, DataType::TYPE_STRING);
 | 
					                $cell->setValueExplicit($value, DataType::TYPE_STRING);
 | 
				
			||||||
                // Set style
 | 
					                // Set style
 | 
				
			||||||
                $cell->getWorksheet()->getStyle($cell->getCoordinate())
 | 
					                $cell->getWorksheet()->getStyle($cell->getCoordinate())
 | 
				
			||||||
 | 
				
			|||||||
@ -90,7 +90,7 @@ class DataType
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // string must never be longer than 32,767 characters, truncate if necessary
 | 
					        // string must never be longer than 32,767 characters, truncate if necessary
 | 
				
			||||||
        $pValue = \PHPExcel\Shared\StringHelper::Substring($pValue, 0, 32767);
 | 
					        $pValue = \PHPExcel\Shared\StringHelper::substring($pValue, 0, 32767);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
 | 
					        // we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
 | 
				
			||||||
        $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
 | 
					        $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@ class DefaultValueBinder implements IValueBinder
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        // sanitize UTF-8 strings
 | 
					        // sanitize UTF-8 strings
 | 
				
			||||||
        if (is_string($value)) {
 | 
					        if (is_string($value)) {
 | 
				
			||||||
            $value = \PHPExcel\Shared\StringHelper::SanitizeUTF8($value);
 | 
					            $value = \PHPExcel\Shared\StringHelper::sanitizeUTF8($value);
 | 
				
			||||||
        } elseif (is_object($value)) {
 | 
					        } elseif (is_object($value)) {
 | 
				
			||||||
            // Handle any objects that might be injected
 | 
					            // Handle any objects that might be injected
 | 
				
			||||||
            if ($value instanceof \DateTime) {
 | 
					            if ($value instanceof \DateTime) {
 | 
				
			||||||
 | 
				
			|||||||
@ -281,7 +281,7 @@ class CSV extends BaseReader implements IReader
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    // Convert encoding if necessary
 | 
					                    // Convert encoding if necessary
 | 
				
			||||||
                    if ($this->inputEncoding !== 'UTF-8') {
 | 
					                    if ($this->inputEncoding !== 'UTF-8') {
 | 
				
			||||||
                        $rowDatum = \PHPExcel\Shared\StringHelper::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
 | 
					                        $rowDatum = \PHPExcel\Shared\StringHelper::convertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Set cell value
 | 
					                    // Set cell value
 | 
				
			||||||
 | 
				
			|||||||
@ -789,7 +789,7 @@ class Excel2003XML extends BaseReader implements IReader
 | 
				
			|||||||
    protected static function convertStringEncoding($string, $charset)
 | 
					    protected static function convertStringEncoding($string, $charset)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($charset != 'UTF-8') {
 | 
					        if ($charset != 'UTF-8') {
 | 
				
			||||||
            return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', $charset);
 | 
					            return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', $charset);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return $string;
 | 
					        return $string;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -525,7 +525,7 @@ class Excel2007 extends BaseReader implements IReader
 | 
				
			|||||||
                    if (isset($xmlStrings) && isset($xmlStrings->si)) {
 | 
					                    if (isset($xmlStrings) && isset($xmlStrings->si)) {
 | 
				
			||||||
                        foreach ($xmlStrings->si as $val) {
 | 
					                        foreach ($xmlStrings->si as $val) {
 | 
				
			||||||
                            if (isset($val->t)) {
 | 
					                            if (isset($val->t)) {
 | 
				
			||||||
                                $sharedStrings[] = \PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $val->t);
 | 
					                                $sharedStrings[] = \PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $val->t);
 | 
				
			||||||
                            } elseif (isset($val->r)) {
 | 
					                            } elseif (isset($val->r)) {
 | 
				
			||||||
                                $sharedStrings[] = $this->parseRichText($val);
 | 
					                                $sharedStrings[] = $this->parseRichText($val);
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
@ -2071,14 +2071,14 @@ class Excel2007 extends BaseReader implements IReader
 | 
				
			|||||||
        $value = new \PHPExcel\RichText();
 | 
					        $value = new \PHPExcel\RichText();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($is->t)) {
 | 
					        if (isset($is->t)) {
 | 
				
			||||||
            $value->createText(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $is->t));
 | 
					            $value->createText(\PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $is->t));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            if (is_object($is->r)) {
 | 
					            if (is_object($is->r)) {
 | 
				
			||||||
                foreach ($is->r as $run) {
 | 
					                foreach ($is->r as $run) {
 | 
				
			||||||
                    if (!isset($run->rPr)) {
 | 
					                    if (!isset($run->rPr)) {
 | 
				
			||||||
                        $objText = $value->createText(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $run->t));
 | 
					                        $objText = $value->createText(\PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $run->t));
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        $objText = $value->createTextRun(\PHPExcel\Shared\StringHelper::ControlCharacterOOXML2PHP((string) $run->t));
 | 
					                        $objText = $value->createTextRun(\PHPExcel\Shared\StringHelper::controlCharacterOOXML2PHP((string) $run->t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if (isset($run->rPr->rFont["val"])) {
 | 
					                        if (isset($run->rPr->rFont["val"])) {
 | 
				
			||||||
                            $objText->getFont()->setName((string) $run->rPr->rFont["val"]);
 | 
					                            $objText->getFont()->setName((string) $run->rPr->rFont["val"]);
 | 
				
			||||||
 | 
				
			|||||||
@ -1343,7 +1343,7 @@ class Excel5 extends BaseReader implements IReader
 | 
				
			|||||||
                case 0x1E: // null-terminated string prepended by dword string length
 | 
					                case 0x1E: // null-terminated string prepended by dword string length
 | 
				
			||||||
                    $byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset);
 | 
					                    $byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset);
 | 
				
			||||||
                    $value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength);
 | 
					                    $value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength);
 | 
				
			||||||
                    $value = \PHPExcel\Shared\StringHelper::ConvertEncoding($value, 'UTF-8', $codePage);
 | 
					                    $value = \PHPExcel\Shared\StringHelper::convertEncoding($value, 'UTF-8', $codePage);
 | 
				
			||||||
                    $value = rtrim($value);
 | 
					                    $value = rtrim($value);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
 | 
					                case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
 | 
				
			||||||
@ -1489,7 +1489,7 @@ class Excel5 extends BaseReader implements IReader
 | 
				
			|||||||
                case 0x1E:    //    null-terminated string prepended by dword string length
 | 
					                case 0x1E:    //    null-terminated string prepended by dword string length
 | 
				
			||||||
                    $byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset);
 | 
					                    $byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset);
 | 
				
			||||||
                    $value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
 | 
					                    $value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
 | 
				
			||||||
                    $value = \PHPExcel\Shared\StringHelper::ConvertEncoding($value, 'UTF-8', $codePage);
 | 
					                    $value = \PHPExcel\Shared\StringHelper::convertEncoding($value, 'UTF-8', $codePage);
 | 
				
			||||||
                    $value = rtrim($value);
 | 
					                    $value = rtrim($value);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                case 0x40:    //    Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
 | 
					                case 0x40:    //    Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
 | 
				
			||||||
@ -3688,13 +3688,13 @@ class Excel5 extends BaseReader implements IReader
 | 
				
			|||||||
                $sstCount = count($this->sst[$index]['fmtRuns']);
 | 
					                $sstCount = count($this->sst[$index]['fmtRuns']);
 | 
				
			||||||
                for ($i = 0; $i <= $sstCount; ++$i) {
 | 
					                for ($i = 0; $i <= $sstCount; ++$i) {
 | 
				
			||||||
                    if (isset($fmtRuns[$i])) {
 | 
					                    if (isset($fmtRuns[$i])) {
 | 
				
			||||||
                        $text = \PHPExcel\Shared\StringHelper::Substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
 | 
					                        $text = \PHPExcel\Shared\StringHelper::substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos);
 | 
				
			||||||
                        $charPos = $fmtRuns[$i]['charPos'];
 | 
					                        $charPos = $fmtRuns[$i]['charPos'];
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        $text = \PHPExcel\Shared\StringHelper::Substring($this->sst[$index]['value'], $charPos, \PHPExcel\Shared\StringHelper::CountCharacters($this->sst[$index]['value']));
 | 
					                        $text = \PHPExcel\Shared\StringHelper::substring($this->sst[$index]['value'], $charPos, \PHPExcel\Shared\StringHelper::countCharacters($this->sst[$index]['value']));
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (\PHPExcel\Shared\StringHelper::CountCharacters($text) > 0) {
 | 
					                    if (\PHPExcel\Shared\StringHelper::countCharacters($text) > 0) {
 | 
				
			||||||
                        if ($i == 0) { // first text run, no style
 | 
					                        if ($i == 0) { // first text run, no style
 | 
				
			||||||
                            $richText->createText($text);
 | 
					                            $richText->createText($text);
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
@ -7502,7 +7502,7 @@ class Excel5 extends BaseReader implements IReader
 | 
				
			|||||||
            $string = self::uncompressByteString($string);
 | 
					            $string = self::uncompressByteString($string);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
 | 
					        return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', 'UTF-16LE');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -7532,7 +7532,7 @@ class Excel5 extends BaseReader implements IReader
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private function decodeCodepage($string)
 | 
					    private function decodeCodepage($string)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return \PHPExcel\Shared\StringHelper::ConvertEncoding($string, 'UTF-8', $this->codepage);
 | 
					        return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', $this->codepage);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -340,27 +340,27 @@ class Font
 | 
				
			|||||||
        switch ($fontName) {
 | 
					        switch ($fontName) {
 | 
				
			||||||
            case 'Calibri':
 | 
					            case 'Calibri':
 | 
				
			||||||
                // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font.
 | 
					                // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font.
 | 
				
			||||||
                $columnWidth = (int) (8.26 * String::CountCharacters($columnText));
 | 
					                $columnWidth = (int) (8.26 * String::countCharacters($columnText));
 | 
				
			||||||
                $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
 | 
					                $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            case 'Arial':
 | 
					            case 'Arial':
 | 
				
			||||||
                // value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
 | 
					                // value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
 | 
				
			||||||
//                $columnWidth = (int) (7 * String::CountCharacters($columnText));
 | 
					//                $columnWidth = (int) (7 * String::countCharacters($columnText));
 | 
				
			||||||
                // value 8 was set because of experience in different exports at Arial 10 font.
 | 
					                // value 8 was set because of experience in different exports at Arial 10 font.
 | 
				
			||||||
                $columnWidth = (int) (8 * String::CountCharacters($columnText));
 | 
					                $columnWidth = (int) (8 * String::countCharacters($columnText));
 | 
				
			||||||
                $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
 | 
					                $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            case 'Verdana':
 | 
					            case 'Verdana':
 | 
				
			||||||
                // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font.
 | 
					                // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font.
 | 
				
			||||||
                $columnWidth = (int) (8 * String::CountCharacters($columnText));
 | 
					                $columnWidth = (int) (8 * String::countCharacters($columnText));
 | 
				
			||||||
                $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
 | 
					                $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                // just assume Calibri
 | 
					                // just assume Calibri
 | 
				
			||||||
                $columnWidth = (int) (8.26 * String::CountCharacters($columnText));
 | 
					                $columnWidth = (int) (8.26 * String::countCharacters($columnText));
 | 
				
			||||||
                $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
 | 
					                $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -345,7 +345,7 @@ class StringHelper
 | 
				
			|||||||
     * @param     string    $value    Value to unescape
 | 
					     * @param     string    $value    Value to unescape
 | 
				
			||||||
     * @return     string
 | 
					     * @return     string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function ControlCharacterOOXML2PHP($value = '')
 | 
					    public static function controlCharacterOOXML2PHP($value = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
 | 
					        return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -364,7 +364,7 @@ class StringHelper
 | 
				
			|||||||
     * @param     string    $value    Value to escape
 | 
					     * @param     string    $value    Value to escape
 | 
				
			||||||
     * @return     string
 | 
					     * @return     string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function ControlCharacterPHP2OOXML($value = '')
 | 
					    public static function controlCharacterPHP2OOXML($value = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
 | 
					        return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -375,7 +375,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $value
 | 
					     * @param string $value
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function SanitizeUTF8($value)
 | 
					    public static function sanitizeUTF8($value)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (self::getIsIconvEnabled()) {
 | 
					        if (self::getIsIconvEnabled()) {
 | 
				
			||||||
            $value = @iconv('UTF-8', 'UTF-8', $value);
 | 
					            $value = @iconv('UTF-8', 'UTF-8', $value);
 | 
				
			||||||
@ -397,7 +397,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $value
 | 
					     * @param string $value
 | 
				
			||||||
     * @return boolean
 | 
					     * @return boolean
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function IsUTF8($value = '')
 | 
					    public static function isUTF8($value = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $value === '' || preg_match('/^./su', $value) === 1;
 | 
					        return $value === '' || preg_match('/^./su', $value) === 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -409,7 +409,7 @@ class StringHelper
 | 
				
			|||||||
     * @param mixed $value
 | 
					     * @param mixed $value
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function FormatNumber($value)
 | 
					    public static function formatNumber($value)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (is_float($value)) {
 | 
					        if (is_float($value)) {
 | 
				
			||||||
            return str_replace(',', '.', $value);
 | 
					            return str_replace(',', '.', $value);
 | 
				
			||||||
@ -431,19 +431,19 @@ class StringHelper
 | 
				
			|||||||
    public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array())
 | 
					    public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // character count
 | 
					        // character count
 | 
				
			||||||
        $ln = self::CountCharacters($value, 'UTF-8');
 | 
					        $ln = self::countCharacters($value, 'UTF-8');
 | 
				
			||||||
        // option flags
 | 
					        // option flags
 | 
				
			||||||
        if (empty($arrcRuns)) {
 | 
					        if (empty($arrcRuns)) {
 | 
				
			||||||
            $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
 | 
					            $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
 | 
				
			||||||
                0x0001 : 0x0000;
 | 
					                0x0001 : 0x0000;
 | 
				
			||||||
            $data = pack('CC', $ln, $opt);
 | 
					            $data = pack('CC', $ln, $opt);
 | 
				
			||||||
            // characters
 | 
					            // characters
 | 
				
			||||||
            $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
 | 
					            $data .= self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $data = pack('vC', $ln, 0x09);
 | 
					            $data = pack('vC', $ln, 0x09);
 | 
				
			||||||
            $data .= pack('v', count($arrcRuns));
 | 
					            $data .= pack('v', count($arrcRuns));
 | 
				
			||||||
            // characters
 | 
					            // characters
 | 
				
			||||||
            $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
 | 
					            $data .= self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
 | 
				
			||||||
            foreach ($arrcRuns as $cRun) {
 | 
					            foreach ($arrcRuns as $cRun) {
 | 
				
			||||||
                $data .= pack('v', $cRun['strlen']);
 | 
					                $data .= pack('v', $cRun['strlen']);
 | 
				
			||||||
                $data .= pack('v', $cRun['fontidx']);
 | 
					                $data .= pack('v', $cRun['fontidx']);
 | 
				
			||||||
@ -465,14 +465,14 @@ class StringHelper
 | 
				
			|||||||
    public static function UTF8toBIFF8UnicodeLong($value)
 | 
					    public static function UTF8toBIFF8UnicodeLong($value)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // character count
 | 
					        // character count
 | 
				
			||||||
        $ln = self::CountCharacters($value, 'UTF-8');
 | 
					        $ln = self::countCharacters($value, 'UTF-8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // option flags
 | 
					        // option flags
 | 
				
			||||||
        $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
 | 
					        $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
 | 
				
			||||||
            0x0001 : 0x0000;
 | 
					            0x0001 : 0x0000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // characters
 | 
					        // characters
 | 
				
			||||||
        $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
 | 
					        $chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $data = pack('vC', $ln, $opt) . $chars;
 | 
					        $data = pack('vC', $ln, $opt) . $chars;
 | 
				
			||||||
        return $data;
 | 
					        return $data;
 | 
				
			||||||
@ -486,7 +486,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $from Encoding to convert from, e.g. 'UTF-16LE'
 | 
					     * @param string $from Encoding to convert from, e.g. 'UTF-16LE'
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function ConvertEncoding($value, $to, $from)
 | 
					    public static function convertEncoding($value, $to, $from)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (self::getIsIconvEnabled()) {
 | 
					        if (self::getIsIconvEnabled()) {
 | 
				
			||||||
            return iconv($from, $to, $value);
 | 
					            return iconv($from, $to, $value);
 | 
				
			||||||
@ -497,9 +497,9 @@ class StringHelper
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($from == 'UTF-16LE') {
 | 
					        if ($from == 'UTF-16LE') {
 | 
				
			||||||
            return self::utf16_decode($value, false);
 | 
					            return self::utf16Decode($value, false);
 | 
				
			||||||
        } elseif ($from == 'UTF-16BE') {
 | 
					        } elseif ($from == 'UTF-16BE') {
 | 
				
			||||||
            return self::utf16_decode($value);
 | 
					            return self::utf16Decode($value);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // else, no conversion
 | 
					        // else, no conversion
 | 
				
			||||||
        return $value;
 | 
					        return $value;
 | 
				
			||||||
@ -520,7 +520,7 @@ class StringHelper
 | 
				
			|||||||
     * @author  Rasmus Andersson {@link http://rasmusandersson.se/}
 | 
					     * @author  Rasmus Andersson {@link http://rasmusandersson.se/}
 | 
				
			||||||
     * @author vadik56
 | 
					     * @author vadik56
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function utf16_decode($str, $bom_be = true)
 | 
					    public static function utf16Decode($str, $bom_be = true)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (strlen($str) < 2) {
 | 
					        if (strlen($str) < 2) {
 | 
				
			||||||
            return $str;
 | 
					            return $str;
 | 
				
			||||||
@ -555,7 +555,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $enc Encoding
 | 
					     * @param string $enc Encoding
 | 
				
			||||||
     * @return int Character count
 | 
					     * @return int Character count
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function CountCharacters($value, $enc = 'UTF-8')
 | 
					    public static function countCharacters($value, $enc = 'UTF-8')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (self::getIsMbstringEnabled()) {
 | 
					        if (self::getIsMbstringEnabled()) {
 | 
				
			||||||
            return mb_strlen($value, $enc);
 | 
					            return mb_strlen($value, $enc);
 | 
				
			||||||
@ -577,7 +577,7 @@ class StringHelper
 | 
				
			|||||||
     * @param int $pLength Maximum number of characters in substring
 | 
					     * @param int $pLength Maximum number of characters in substring
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
 | 
					    public static function substring($pValue = '', $pStart = 0, $pLength = 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (self::getIsMbstringEnabled()) {
 | 
					        if (self::getIsMbstringEnabled()) {
 | 
				
			||||||
            return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
 | 
					            return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
 | 
				
			||||||
@ -597,7 +597,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $pValue UTF-8 encoded string
 | 
					     * @param string $pValue UTF-8 encoded string
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function StrToUpper($pValue = '')
 | 
					    public static function strToUpper($pValue = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (function_exists('mb_convert_case')) {
 | 
					        if (function_exists('mb_convert_case')) {
 | 
				
			||||||
            return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8");
 | 
					            return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8");
 | 
				
			||||||
@ -611,7 +611,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $pValue UTF-8 encoded string
 | 
					     * @param string $pValue UTF-8 encoded string
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function StrToLower($pValue = '')
 | 
					    public static function strToLower($pValue = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (function_exists('mb_convert_case')) {
 | 
					        if (function_exists('mb_convert_case')) {
 | 
				
			||||||
            return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
 | 
					            return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
 | 
				
			||||||
@ -626,7 +626,7 @@ class StringHelper
 | 
				
			|||||||
     * @param string $pValue UTF-8 encoded string
 | 
					     * @param string $pValue UTF-8 encoded string
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function StrToTitle($pValue = '')
 | 
					    public static function strToTitle($pValue = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (function_exists('mb_convert_case')) {
 | 
					        if (function_exists('mb_convert_case')) {
 | 
				
			||||||
            return mb_convert_case($pValue, MB_CASE_TITLE, "UTF-8");
 | 
					            return mb_convert_case($pValue, MB_CASE_TITLE, "UTF-8");
 | 
				
			||||||
@ -634,12 +634,12 @@ class StringHelper
 | 
				
			|||||||
        return ucwords($pValue);
 | 
					        return ucwords($pValue);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function mb_is_upper($char)
 | 
					    public static function mbIsUpper($char)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return mb_strtolower($char, "UTF-8") != $char;
 | 
					        return mb_strtolower($char, "UTF-8") != $char;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function mb_str_split($string)
 | 
					    public static function mbStrSplit($string)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        # Split at all position not after the start: ^
 | 
					        # Split at all position not after the start: ^
 | 
				
			||||||
        # and not before the end: $
 | 
					        # and not before the end: $
 | 
				
			||||||
@ -653,12 +653,12 @@ class StringHelper
 | 
				
			|||||||
     * @param string $pValue UTF-8 encoded string
 | 
					     * @param string $pValue UTF-8 encoded string
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function StrCaseReverse($pValue = '')
 | 
					    public static function strCaseReverse($pValue = '')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (self::getIsMbstringEnabled()) {
 | 
					        if (self::getIsMbstringEnabled()) {
 | 
				
			||||||
            $characters = self::mb_str_split($pValue);
 | 
					            $characters = self::mbStrSplit($pValue);
 | 
				
			||||||
            foreach ($characters as &$character) {
 | 
					            foreach ($characters as &$character) {
 | 
				
			||||||
                if (self::mb_is_upper($character)) {
 | 
					                if (self::mbIsUpper($character)) {
 | 
				
			||||||
                    $character = mb_strtolower($character, 'UTF-8');
 | 
					                    $character = mb_strtolower($character, 'UTF-8');
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    $character = mb_strtoupper($character, 'UTF-8');
 | 
					                    $character = mb_strtoupper($character, 'UTF-8');
 | 
				
			||||||
 | 
				
			|||||||
@ -420,14 +420,14 @@ class Worksheet implements IComparable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private static function checkSheetCodeName($pValue)
 | 
					    private static function checkSheetCodeName($pValue)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $CharCount = Shared\String::CountCharacters($pValue);
 | 
					        $CharCount = Shared\StringHelper::countCharacters($pValue);
 | 
				
			||||||
        if ($CharCount == 0) {
 | 
					        if ($CharCount == 0) {
 | 
				
			||||||
            throw new Exception('Sheet code name cannot be empty.');
 | 
					            throw new Exception('Sheet code name cannot be empty.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // Some of the printable ASCII characters are invalid:  * : / \ ? [ ] and  first and last characters cannot be a "'"
 | 
					        // Some of the printable ASCII characters are invalid:  * : / \ ? [ ] and  first and last characters cannot be a "'"
 | 
				
			||||||
        if ((str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) ||
 | 
					        if ((str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) ||
 | 
				
			||||||
            (Shared\String::Substring($pValue, -1, 1)=='\'') ||
 | 
					            (Shared\StringHelper::substring($pValue, -1, 1)=='\'') ||
 | 
				
			||||||
            (Shared\String::Substring($pValue, 0, 1)=='\'')) {
 | 
					            (Shared\StringHelper::substring($pValue, 0, 1)=='\'')) {
 | 
				
			||||||
            throw new Exception('Invalid character found in sheet code name');
 | 
					            throw new Exception('Invalid character found in sheet code name');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -454,7 +454,7 @@ class Worksheet implements IComparable
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Maximum 31 characters allowed for sheet title
 | 
					        // Maximum 31 characters allowed for sheet title
 | 
				
			||||||
        if (Shared\String::CountCharacters($pValue) > 31) {
 | 
					        if (Shared\StringHelper::countCharacters($pValue) > 31) {
 | 
				
			||||||
            throw new Exception('Maximum 31 characters allowed in sheet title.');
 | 
					            throw new Exception('Maximum 31 characters allowed in sheet title.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -837,19 +837,19 @@ class Worksheet implements IComparable
 | 
				
			|||||||
            if ($this->parent->sheetNameExists($pValue)) {
 | 
					            if ($this->parent->sheetNameExists($pValue)) {
 | 
				
			||||||
                // Use name, but append with lowest possible integer
 | 
					                // Use name, but append with lowest possible integer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (Shared\String::CountCharacters($pValue) > 29) {
 | 
					                if (Shared\StringHelper::countCharacters($pValue) > 29) {
 | 
				
			||||||
                    $pValue = Shared\String::Substring($pValue, 0, 29);
 | 
					                    $pValue = Shared\StringHelper::substring($pValue, 0, 29);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                $i = 1;
 | 
					                $i = 1;
 | 
				
			||||||
                while ($this->parent->sheetNameExists($pValue . ' ' . $i)) {
 | 
					                while ($this->parent->sheetNameExists($pValue . ' ' . $i)) {
 | 
				
			||||||
                    ++$i;
 | 
					                    ++$i;
 | 
				
			||||||
                    if ($i == 10) {
 | 
					                    if ($i == 10) {
 | 
				
			||||||
                        if (Shared\String::CountCharacters($pValue) > 28) {
 | 
					                        if (Shared\StringHelper::countCharacters($pValue) > 28) {
 | 
				
			||||||
                            $pValue = Shared\String::Substring($pValue, 0, 28);
 | 
					                            $pValue = Shared\StringHelper::substring($pValue, 0, 28);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } elseif ($i == 100) {
 | 
					                    } elseif ($i == 100) {
 | 
				
			||||||
                        if (Shared\String::CountCharacters($pValue) > 27) {
 | 
					                        if (Shared\StringHelper::countCharacters($pValue) > 27) {
 | 
				
			||||||
                            $pValue = Shared\String::Substring($pValue, 0, 27);
 | 
					                            $pValue = Shared\StringHelper::substring($pValue, 0, 27);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@ -2924,19 +2924,19 @@ class Worksheet implements IComparable
 | 
				
			|||||||
            if ($this->getParent()->sheetCodeNameExists($pValue)) {
 | 
					            if ($this->getParent()->sheetCodeNameExists($pValue)) {
 | 
				
			||||||
                // Use name, but append with lowest possible integer
 | 
					                // Use name, but append with lowest possible integer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (Shared\String::CountCharacters($pValue) > 29) {
 | 
					                if (Shared\StringHelper::countCharacters($pValue) > 29) {
 | 
				
			||||||
                    $pValue = Shared\String::Substring($pValue, 0, 29);
 | 
					                    $pValue = Shared\StringHelper::substring($pValue, 0, 29);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                $i = 1;
 | 
					                $i = 1;
 | 
				
			||||||
                while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
 | 
					                while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
 | 
				
			||||||
                    ++$i;
 | 
					                    ++$i;
 | 
				
			||||||
                    if ($i == 10) {
 | 
					                    if ($i == 10) {
 | 
				
			||||||
                        if (Shared\String::CountCharacters($pValue) > 28) {
 | 
					                        if (Shared\StringHelper::countCharacters($pValue) > 28) {
 | 
				
			||||||
                            $pValue = Shared\String::Substring($pValue, 0, 28);
 | 
					                            $pValue = Shared\StringHelper::substring($pValue, 0, 28);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } elseif ($i == 100) {
 | 
					                    } elseif ($i == 100) {
 | 
				
			||||||
                        if (Shared\String::CountCharacters($pValue) > 27) {
 | 
					                        if (Shared\StringHelper::countCharacters($pValue) > 27) {
 | 
				
			||||||
                            $pValue = Shared\String::Substring($pValue, 0, 27);
 | 
					                            $pValue = Shared\StringHelper::substring($pValue, 0, 27);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -460,7 +460,7 @@ class Chart extends WriterPart
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            $objWriter->startElement('a:t');
 | 
					            $objWriter->startElement('a:t');
 | 
				
			||||||
            //                                        $objWriter->writeAttribute('xml:space', 'preserve');
 | 
					            //                                        $objWriter->writeAttribute('xml:space', 'preserve');
 | 
				
			||||||
            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($caption));
 | 
					            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($caption));
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
@ -810,7 +810,7 @@ class Chart extends WriterPart
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $objWriter->startElement('a:t');
 | 
					            $objWriter->startElement('a:t');
 | 
				
			||||||
            //                                        $objWriter->writeAttribute('xml:space', 'preserve');
 | 
					            //                                        $objWriter->writeAttribute('xml:space', 'preserve');
 | 
				
			||||||
            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($caption));
 | 
					            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($caption));
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
 | 
				
			|||||||
@ -109,7 +109,7 @@ class StringTable extends WriterPart
 | 
				
			|||||||
                $objWriter->startElement('si');
 | 
					                $objWriter->startElement('si');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (! $textElement instanceof \PHPExcel\RichText) {
 | 
					                if (! $textElement instanceof \PHPExcel\RichText) {
 | 
				
			||||||
                    $textToWrite = \PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($textElement);
 | 
					                    $textToWrite = \PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($textElement);
 | 
				
			||||||
                    $objWriter->startElement('t');
 | 
					                    $objWriter->startElement('t');
 | 
				
			||||||
                    if ($textToWrite !== trim($textToWrite)) {
 | 
					                    if ($textToWrite !== trim($textToWrite)) {
 | 
				
			||||||
                        $objWriter->writeAttribute('xml:space', 'preserve');
 | 
					                        $objWriter->writeAttribute('xml:space', 'preserve');
 | 
				
			||||||
@ -208,7 +208,7 @@ class StringTable extends WriterPart
 | 
				
			|||||||
            // t
 | 
					            // t
 | 
				
			||||||
            $objWriter->startElement($prefix.'t');
 | 
					            $objWriter->startElement($prefix.'t');
 | 
				
			||||||
            $objWriter->writeAttribute('xml:space', 'preserve');
 | 
					            $objWriter->writeAttribute('xml:space', 'preserve');
 | 
				
			||||||
            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($element->getText()));
 | 
					            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($element->getText()));
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
@ -283,7 +283,7 @@ class StringTable extends WriterPart
 | 
				
			|||||||
            // t
 | 
					            // t
 | 
				
			||||||
            $objWriter->startElement($prefix.'t');
 | 
					            $objWriter->startElement($prefix.'t');
 | 
				
			||||||
//                    $objWriter->writeAttribute('xml:space', 'preserve');    //    Excel2010 accepts, Excel2007 complains
 | 
					//                    $objWriter->writeAttribute('xml:space', 'preserve');    //    Excel2010 accepts, Excel2007 complains
 | 
				
			||||||
            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML($element->getText()));
 | 
					            $objWriter->writeRawData(\PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML($element->getText()));
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $objWriter->endElement();
 | 
					            $objWriter->endElement();
 | 
				
			||||||
 | 
				
			|||||||
@ -327,7 +327,7 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
        // Default row height
 | 
					        // Default row height
 | 
				
			||||||
        if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
 | 
					        if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
 | 
				
			||||||
            $objWriter->writeAttribute('customHeight', 'true');
 | 
					            $objWriter->writeAttribute('customHeight', 'true');
 | 
				
			||||||
            $objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
 | 
					            $objWriter->writeAttribute('defaultRowHeight', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $objWriter->writeAttribute('defaultRowHeight', '14.4');
 | 
					            $objWriter->writeAttribute('defaultRowHeight', '14.4');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -340,7 +340,7 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Default column width
 | 
					        // Default column width
 | 
				
			||||||
        if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
 | 
					        if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
 | 
				
			||||||
            $objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
 | 
					            $objWriter->writeAttribute('defaultColWidth', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Outline level - row
 | 
					        // Outline level - row
 | 
				
			||||||
@ -391,7 +391,7 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
                    $objWriter->writeAttribute('width', '9.10');
 | 
					                    $objWriter->writeAttribute('width', '9.10');
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    // Width set
 | 
					                    // Width set
 | 
				
			||||||
                    $objWriter->writeAttribute('width', \PHPExcel\Shared\StringHelper::FormatNumber($colDimension->getWidth()));
 | 
					                    $objWriter->writeAttribute('width', \PHPExcel\Shared\StringHelper::formatNumber($colDimension->getWidth()));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Column visibility
 | 
					                // Column visibility
 | 
				
			||||||
@ -735,12 +735,12 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        // pageMargins
 | 
					        // pageMargins
 | 
				
			||||||
        $objWriter->startElement('pageMargins');
 | 
					        $objWriter->startElement('pageMargins');
 | 
				
			||||||
        $objWriter->writeAttribute('left', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getLeft()));
 | 
					        $objWriter->writeAttribute('left', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getLeft()));
 | 
				
			||||||
        $objWriter->writeAttribute('right', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getRight()));
 | 
					        $objWriter->writeAttribute('right', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getRight()));
 | 
				
			||||||
        $objWriter->writeAttribute('top', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getTop()));
 | 
					        $objWriter->writeAttribute('top', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getTop()));
 | 
				
			||||||
        $objWriter->writeAttribute('bottom', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getBottom()));
 | 
					        $objWriter->writeAttribute('bottom', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getBottom()));
 | 
				
			||||||
        $objWriter->writeAttribute('header', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getHeader()));
 | 
					        $objWriter->writeAttribute('header', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getHeader()));
 | 
				
			||||||
        $objWriter->writeAttribute('footer', \PHPExcel\Shared\StringHelper::FormatNumber($pSheet->getPageMargins()->getFooter()));
 | 
					        $objWriter->writeAttribute('footer', \PHPExcel\Shared\StringHelper::formatNumber($pSheet->getPageMargins()->getFooter()));
 | 
				
			||||||
        $objWriter->endElement();
 | 
					        $objWriter->endElement();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1001,7 +1001,7 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
                    // Row dimensions
 | 
					                    // Row dimensions
 | 
				
			||||||
                    if ($rowDimension->getRowHeight() >= 0) {
 | 
					                    if ($rowDimension->getRowHeight() >= 0) {
 | 
				
			||||||
                        $objWriter->writeAttribute('customHeight', '1');
 | 
					                        $objWriter->writeAttribute('customHeight', '1');
 | 
				
			||||||
                        $objWriter->writeAttribute('ht', \PHPExcel\Shared\StringHelper::FormatNumber($rowDimension->getRowHeight()));
 | 
					                        $objWriter->writeAttribute('ht', \PHPExcel\Shared\StringHelper::formatNumber($rowDimension->getRowHeight()));
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Row visibility
 | 
					                    // Row visibility
 | 
				
			||||||
@ -1096,7 +1096,7 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
                switch (strtolower($mappedType)) {
 | 
					                switch (strtolower($mappedType)) {
 | 
				
			||||||
                    case 'inlinestr':    // Inline string
 | 
					                    case 'inlinestr':    // Inline string
 | 
				
			||||||
                        if (! $cellValue instanceof \PHPExcel\RichText) {
 | 
					                        if (! $cellValue instanceof \PHPExcel\RichText) {
 | 
				
			||||||
                            $objWriter->writeElement('t', \PHPExcel\Shared\StringHelper::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
 | 
					                            $objWriter->writeElement('t', \PHPExcel\Shared\StringHelper::controlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
 | 
				
			||||||
                        } elseif ($cellValue instanceof \PHPExcel\RichText) {
 | 
					                        } elseif ($cellValue instanceof \PHPExcel\RichText) {
 | 
				
			||||||
                            $objWriter->startElement('is');
 | 
					                            $objWriter->startElement('is');
 | 
				
			||||||
                            $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
 | 
					                            $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
 | 
				
			||||||
@ -1131,7 +1131,7 @@ class Worksheet extends WriterPart
 | 
				
			|||||||
                            if ($this->getParentWriter()->getPreCalculateFormulas()) {
 | 
					                            if ($this->getParentWriter()->getPreCalculateFormulas()) {
 | 
				
			||||||
//                                $calculatedValue = $pCell->getCalculatedValue();
 | 
					//                                $calculatedValue = $pCell->getCalculatedValue();
 | 
				
			||||||
                                if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
 | 
					                                if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
 | 
				
			||||||
                                    $objWriter->writeElement('v', \PHPExcel\Shared\StringHelper::FormatNumber($calculatedValue));
 | 
					                                    $objWriter->writeElement('v', \PHPExcel\Shared\StringHelper::formatNumber($calculatedValue));
 | 
				
			||||||
                                } else {
 | 
					                                } else {
 | 
				
			||||||
                                    $objWriter->writeElement('v', '0');
 | 
					                                    $objWriter->writeElement('v', '0');
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
 | 
				
			|||||||
@ -804,7 +804,7 @@ class Workbook extends BIFFwriter
 | 
				
			|||||||
        $options = $isBuiltIn ? 0x20 : 0x00;
 | 
					        $options = $isBuiltIn ? 0x20 : 0x00;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // length of the name, character count
 | 
					        // length of the name, character count
 | 
				
			||||||
        $nlen = \PHPExcel\Shared\StringHelper::CountCharacters($name);
 | 
					        $nlen = \PHPExcel\Shared\StringHelper::countCharacters($name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // name with stripped length field
 | 
					        // name with stripped length field
 | 
				
			||||||
        $name = substr(\PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($name), 2);
 | 
					        $name = substr(\PHPExcel\Shared\StringHelper::UTF8toBIFF8UnicodeLong($name), 2);
 | 
				
			||||||
 | 
				
			|||||||
@ -403,7 +403,7 @@ class Worksheet extends BIFFwriter
 | 
				
			|||||||
            if ($cVal instanceof \PHPExcel\RichText) {
 | 
					            if ($cVal instanceof \PHPExcel\RichText) {
 | 
				
			||||||
                // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
 | 
					                // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
 | 
				
			||||||
                $arrcRun = array();
 | 
					                $arrcRun = array();
 | 
				
			||||||
                $str_len = \PHPExcel\Shared\StringHelper::CountCharacters($cVal->getPlainText(), 'UTF-8');
 | 
					                $str_len = \PHPExcel\Shared\StringHelper::countCharacters($cVal->getPlainText(), 'UTF-8');
 | 
				
			||||||
                $str_pos = 0;
 | 
					                $str_pos = 0;
 | 
				
			||||||
                $elements = $cVal->getRichTextElements();
 | 
					                $elements = $cVal->getRichTextElements();
 | 
				
			||||||
                foreach ($elements as $element) {
 | 
					                foreach ($elements as $element) {
 | 
				
			||||||
@ -415,7 +415,7 @@ class Worksheet extends BIFFwriter
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
 | 
					                    $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
 | 
				
			||||||
                    // Position FROM
 | 
					                    // Position FROM
 | 
				
			||||||
                    $str_pos += \PHPExcel\Shared\StringHelper::CountCharacters($element->getText(), 'UTF-8');
 | 
					                    $str_pos += \PHPExcel\Shared\StringHelper::countCharacters($element->getText(), 'UTF-8');
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
 | 
					                $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
@ -1054,10 +1054,10 @@ class Worksheet extends BIFFwriter
 | 
				
			|||||||
        $url .= "\0";
 | 
					        $url .= "\0";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // character count
 | 
					        // character count
 | 
				
			||||||
        $url_len = \PHPExcel\Shared\StringHelper::CountCharacters($url);
 | 
					        $url_len = \PHPExcel\Shared\StringHelper::countCharacters($url);
 | 
				
			||||||
        $url_len = pack('V', $url_len);
 | 
					        $url_len = pack('V', $url_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $url = \PHPExcel\Shared\StringHelper::ConvertEncoding($url, 'UTF-16LE', 'UTF-8');
 | 
					        $url = \PHPExcel\Shared\StringHelper::convertEncoding($url, 'UTF-16LE', 'UTF-8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Calculate the data length
 | 
					        // Calculate the data length
 | 
				
			||||||
        $length      = 0x24 + strlen($url);
 | 
					        $length      = 0x24 + strlen($url);
 | 
				
			||||||
 | 
				
			|||||||
@ -1597,16 +1597,16 @@ class HTML extends BaseWriter implements IWriter
 | 
				
			|||||||
        $htmlPage = '@page { ';
 | 
					        $htmlPage = '@page { ';
 | 
				
			||||||
        $htmlBody = 'body { ';
 | 
					        $htmlBody = 'body { ';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $left = String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
 | 
					        $left = StringHelper::formatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
 | 
				
			||||||
        $htmlPage .= 'margin-left: ' . $left;
 | 
					        $htmlPage .= 'margin-left: ' . $left;
 | 
				
			||||||
        $htmlBody .= 'margin-left: ' . $left;
 | 
					        $htmlBody .= 'margin-left: ' . $left;
 | 
				
			||||||
        $right = String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
 | 
					        $right = StringHelper::formatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
 | 
				
			||||||
        $htmlPage .= 'margin-right: ' . $right;
 | 
					        $htmlPage .= 'margin-right: ' . $right;
 | 
				
			||||||
        $htmlBody .= 'margin-right: ' . $right;
 | 
					        $htmlBody .= 'margin-right: ' . $right;
 | 
				
			||||||
        $top = String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
 | 
					        $top = StringHelper::formatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
 | 
				
			||||||
        $htmlPage .= 'margin-top: ' . $top;
 | 
					        $htmlPage .= 'margin-top: ' . $top;
 | 
				
			||||||
        $htmlBody .= 'margin-top: ' . $top;
 | 
					        $htmlBody .= 'margin-top: ' . $top;
 | 
				
			||||||
        $bottom = String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
 | 
					        $bottom = StringHelper::formatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
 | 
				
			||||||
        $htmlPage .= 'margin-bottom: ' . $bottom;
 | 
					        $htmlPage .= 'margin-bottom: ' . $bottom;
 | 
				
			||||||
        $htmlBody .= 'margin-bottom: ' . $bottom;
 | 
					        $htmlBody .= 'margin-bottom: ' . $bottom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user