You are here

public static function PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php \PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort()

* Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) * Writes the string using uncompressed notation, no rich text, no Asian phonetics * If mbstring extension is not available, ASCII is assumed, and compressed notation is used * although this will give wrong results for non-ASCII strings * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3 * *

Parameters

string $value UTF-8 encoded string: * @param mixed[] $arrcRuns Details of rich text runs in $value * @return string

5 calls to PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort()
PHPExcel_Writer_Excel5_Font::writeFont in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Font.php
* Get font record data * *
PHPExcel_Writer_Excel5_Parser::_convertString in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php
* Convert a string token to ptgStr * * @access private *
PHPExcel_Writer_Excel5_Workbook::_calcSheetOffsets in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Workbook.php
* Calculate offsets for Worksheet BOF records. * * @access private
PHPExcel_Writer_Excel5_Workbook::_writeBoundsheet in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Workbook.php
* Writes Excel BIFF BOUNDSHEET record. * *
PHPExcel_Writer_Excel5_Worksheet::_writeRichTextString in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Worksheet.php
* Write a LABELSST record or a LABEL record. Which one depends on BIFF version * It differs from _writeString by the writing of rich text strings. *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php, line 434

Class

PHPExcel_Shared_String
PHPExcel_Shared_String

Code

public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array()) {

  // character count
  $ln = self::CountCharacters($value, 'UTF-8');

  // option flags
  if (empty($arrcRuns)) {
    $opt = self::getIsIconvEnabled() || self::getIsMbstringEnabled() ? 0x1 : 0x0;
    $data = pack('CC', $ln, $opt);

    // characters
    $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
  }
  else {
    $data = pack('vC', $ln, 0x9);
    $data .= pack('v', count($arrcRuns));

    // characters
    $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
    foreach ($arrcRuns as $cRun) {
      $data .= pack('v', $cRun['strlen']);
      $data .= pack('v', $cRun['fontidx']);
    }
  }
  return $data;
}