本文整理汇总了PHP中PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong方法的具体用法?PHP PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong怎么用?PHP PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Shared_String
的用法示例。
在下文中一共展示了PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _writeCFRule
//.........这里部分代码省略.........
// Border
$flags |= 1 == $bBorderLeft ? 0x400 : 0;
$flags |= 1 == $bBorderRight ? 0x800 : 0;
$flags |= 1 == $bBorderTop ? 0x1000 : 0;
$flags |= 1 == $bBorderBottom ? 0x2000 : 0;
$flags |= 1 == 1 ? 0x4000 : 0;
// Top left to Bottom right border
$flags |= 1 == 1 ? 0x8000 : 0;
// Bottom left to Top right border
// Pattern
$flags |= 1 == $bFillStyle ? 0x10000 : 0;
$flags |= 1 == $bFillColor ? 0x20000 : 0;
$flags |= 1 == $bFillColorBg ? 0x40000 : 0;
$flags |= 1 == 1 ? 0x380000 : 0;
// Font
$flags |= 1 == $bFormatFont ? 0x4000000 : 0;
// Alignment :
$flags |= 1 == $bFormatAlign ? 0x8000000 : 0;
// Border
$flags |= 1 == $bFormatBorder ? 0x10000000 : 0;
// Pattern
$flags |= 1 == $bFormatFill ? 0x20000000 : 0;
// Protection
$flags |= 1 == $bFormatProt ? 0x40000000 : 0;
// Text direction
$flags |= 1 == 0 ? 0x80000000 : 0;
// Data Blocks
if ($bFormatFont == 1) {
// Font Name
if ($conditional->getStyle()->getFont()->getName() == null) {
$dataBlockFont = pack('VVVVVVVV', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0);
$dataBlockFont .= pack('VVVVVVVV', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0);
} else {
$dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
}
// Font Size
if ($conditional->getStyle()->getFont()->getSize() == null) {
$dataBlockFont .= pack('V', 20 * 11);
} else {
$dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize());
}
// Font Options
$dataBlockFont .= pack('V', 0);
// Font weight
if ($conditional->getStyle()->getFont()->getBold() == true) {
$dataBlockFont .= pack('v', 0x2bc);
} else {
$dataBlockFont .= pack('v', 0x190);
}
// Escapement type
if ($conditional->getStyle()->getFont()->getSubScript() == true) {
$dataBlockFont .= pack('v', 0x2);
$fontEscapement = 0;
} else {
if ($conditional->getStyle()->getFont()->getSuperScript() == true) {
$dataBlockFont .= pack('v', 0x1);
$fontEscapement = 0;
} else {
$dataBlockFont .= pack('v', 0x0);
$fontEscapement = 1;
}
}
// Underline type
switch ($conditional->getStyle()->getFont()->getUnderline()) {
case PHPExcel_Style_Font::UNDERLINE_NONE:
$dataBlockFont .= pack('C', 0x0);
示例2: writeNumberFormat
/**
* Writes Excel FORMAT record for non "built-in" numerical formats.
*
* @param string $format Custom format string
* @param integer $ifmt Format index code
*/
private function writeNumberFormat($format, $ifmt)
{
$record = 0x41e;
// Record identifier
$numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format);
$length = 2 + strlen($numberFormatString);
// Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $ifmt) . $numberFormatString;
$this->append($header . $data);
}
示例3: _writeDataValidity
//.........这里部分代码省略.........
break;
case PHPExcel_Cell_DataValidation::STYLE_INFORMATION:
$errorStyle = 0x2;
break;
}
$options |= $errorStyle << 4;
// explicit formula?
if ($type == 0x3 && preg_match('/^\\".*\\"$/', $dataValidation->getFormula1())) {
$options |= 0x1 << 7;
}
// empty cells allowed
$options |= $dataValidation->getAllowBlank() << 8;
// show drop down
$options |= !$dataValidation->getShowDropDown() << 9;
// show input message
$options |= $dataValidation->getShowInputMessage() << 18;
// show error message
$options |= $dataValidation->getShowErrorMessage() << 19;
// condition operator
$operator = $dataValidation->getOperator();
switch ($operator) {
case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN:
$operator = 0x0;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN:
$operator = 0x1;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL:
$operator = 0x2;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL:
$operator = 0x3;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN:
$operator = 0x4;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN:
$operator = 0x5;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL:
$operator = 0x6;
break;
case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL:
$operator = 0x7;
break;
}
$options |= $operator << 20;
$data = pack('V', $options);
// prompt title
$promptTitle = $dataValidation->getPromptTitle() !== '' ? $dataValidation->getPromptTitle() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($promptTitle);
// error title
$errorTitle = $dataValidation->getErrorTitle() !== '' ? $dataValidation->getErrorTitle() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($errorTitle);
// prompt text
$prompt = $dataValidation->getPrompt() !== '' ? $dataValidation->getPrompt() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($prompt);
// error text
$error = $dataValidation->getError() !== '' ? $dataValidation->getError() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($error);
// formula 1
try {
$formula1 = $dataValidation->getFormula1();
if ($type == 0x3) {
// list type
$formula1 = str_replace(',', chr(0), $formula1);
}
$this->_parser->parse($formula1);
$formula1 = $this->_parser->toReversePolish();
$sz1 = strlen($formula1);
} catch (Exception $e) {
$sz1 = 0;
$formula1 = '';
}
$data .= pack('vv', $sz1, 0x0);
$data .= $formula1;
// formula 2
try {
$formula2 = $dataValidation->getFormula2();
if ($formula2 === '') {
throw new Exception('No formula2');
}
$this->_parser->parse($formula2);
$formula2 = $this->_parser->toReversePolish();
$sz2 = strlen($formula2);
} catch (Exception $e) {
$sz2 = 0;
$formula2 = '';
}
$data .= pack('vv', $sz2, 0x0);
$data .= $formula2;
// cell range address list
$data .= pack('v', 0x1);
$data .= $this->_writeBIFF8CellRangeAddressFixed($cellCoordinate);
$length = strlen($data);
$header = pack("vv", $record, $length);
$this->_append($header . $data);
}
}
}
示例4: _storeFooter
/**
* Store the footer caption BIFF record.
*
* @access private
*/
function _storeFooter()
{
$record = 0x15;
// Record identifier
/* removing for now
// need to fix character count (multibyte!)
if (strlen($this->_phpSheet->getHeaderFooter()->getOddFooter()) <= 255) {
$str = $this->_phpSheet->getHeaderFooter()->getOddFooter();
} else {
$str = '';
}
*/
if ($this->_BIFF_version == 0x600) {
$recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddFooter());
$length = strlen($recordData);
} else {
$cch = strlen($str);
// Length of footer string
$length = 1 + $cch;
$data = pack("C", $cch);
$recordData = $data . $str;
}
$header = pack("vv", $record, $length);
$this->_prepend($header . $recordData);
}
示例5: _writeNumFormat
/**
* Writes Excel FORMAT record for non "built-in" numerical formats.
*
* @param string $format Custom format string
* @param integer $ifmt Format index code
*/
private function _writeNumFormat($format, $ifmt)
{
$record = 0x41e;
// Record identifier
if ($this->_BIFF_version == 0x600) {
$numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format);
$length = 2 + strlen($numberFormatString);
// Number of bytes to follow
} elseif ($this->_BIFF_version == 0x500) {
$length = 3 + strlen($format);
// Number of bytes to follow
}
$header = pack("vv", $record, $length);
if ($this->_BIFF_version == 0x600) {
$data = pack("v", $ifmt) . $numberFormatString;
$this->_append($header . $data);
} elseif ($this->_BIFF_version == 0x500) {
$cch = strlen($format);
// Length of format string
$data = pack("vC", $ifmt, $cch);
$this->_append($header . $data . $format);
}
}
示例6: _writeDefinedNameBiff8
/**
* Write a DEFINEDNAME record for BIFF8 using explicit binary formula data
*
* @param string $name The name in UTF-8
* @param string $formulaData The binary formula data
* @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
* @param boolean $isBuiltIn Built-in name?
*
* @return string Complete binary record data
*/
private function _writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false)
{
$record = 0x18;
// option flags
$options = $isBuiltIn ? 0x20 : 0x0;
// length of the name, character count
$nlen = PHPExcel_Shared_String::CountCharacters($name);
// name with stripped length field
$name = substr(PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($name), 2);
// size of the formula (in bytes)
$sz = strlen($formulaData);
// combine the parts
$data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0) . $name . $formulaData;
$length = strlen($data);
$header = pack('vv', $record, $length);
return $header . $data;
}