mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-26 15:26:03 +03:00
Move UTF-8 StrToUpper(), StrToLower() and StrToTitle() methods from Text Calculation class to Shared String Class
Doc comments for methods in writer abstract
This commit is contained in:
parent
cce77bad0e
commit
f3c4d056ed
@ -440,11 +440,7 @@ class PHPExcel_Calculation_TextData {
|
||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8');
|
||||
} else {
|
||||
return strtoupper($mixedCaseString);
|
||||
}
|
||||
return PHPExcel_Shared_String::StrToLower($mixedCaseString);
|
||||
} // function LOWERCASE()
|
||||
|
||||
|
||||
@ -463,11 +459,7 @@ class PHPExcel_Calculation_TextData {
|
||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8');
|
||||
} else {
|
||||
return strtoupper($mixedCaseString);
|
||||
}
|
||||
return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
|
||||
} // function UPPERCASE()
|
||||
|
||||
|
||||
@ -486,11 +478,7 @@ class PHPExcel_Calculation_TextData {
|
||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8');
|
||||
} else {
|
||||
return ucwords($mixedCaseString);
|
||||
}
|
||||
return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
|
||||
} // function PROPERCASE()
|
||||
|
||||
|
||||
|
@ -583,6 +583,48 @@ class PHPExcel_Shared_String
|
||||
return substr($pValue, $pStart, $pLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a UTF-8 encoded string to upper case
|
||||
*
|
||||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrToUpper($pValue = '')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8");
|
||||
}
|
||||
return strtoupper($pValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a UTF-8 encoded string to lower case
|
||||
*
|
||||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrToLower($pValue = '')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
|
||||
}
|
||||
return strtolower($pValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a UTF-8 encoded string to title/proper case
|
||||
* (uppercase every first character in each word, lower case all other characters)
|
||||
*
|
||||
* @param string $pValue UTF-8 encoded string
|
||||
* @return string
|
||||
*/
|
||||
public static function StrToTitle($pValue = '')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
|
||||
}
|
||||
return ucwords($pValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether a string contains a fractional numeric value,
|
||||
|
@ -45,6 +45,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
|
||||
|
||||
/**
|
||||
* Pre-calculate formulas
|
||||
* Forces PHPExcel to recalculate all formulae in a workbook when saving, so that the pre-calculated values are
|
||||
* immediately available to MS Excel or other office spreadsheet viewer when opening the file
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
@ -89,7 +91,12 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Pre-Calculate Formulas
|
||||
* Get Pre-Calculate Formulas flag
|
||||
* If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
|
||||
* so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
|
||||
* viewer when opening the file
|
||||
* If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower
|
||||
* when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@ -99,6 +106,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
|
||||
|
||||
/**
|
||||
* Set Pre-Calculate Formulas
|
||||
* Set to true (the default) to advise the Writer to calculate all formulae on save
|
||||
* Set to false to prevent precalculation of formulae on save.
|
||||
*
|
||||
* @param boolean $pValue Pre-Calculate Formulas?
|
||||
* @return PHPExcel_Writer_IWriter
|
||||
|
Loading…
Reference in New Issue
Block a user