コード例 #1
0
 protected static function convertStringEncoding($string, $charset)
 {
     if ($charset != 'UTF-8') {
         return \PHPExcel\Shared\StringHelper::convertEncoding($string, 'UTF-8', $charset);
     }
     return $string;
 }
コード例 #2
0
ファイル: Worksheet.php プロジェクト: kameshwariv/testexample
 /**
  * Used to write internal reference hyperlinks such as "Sheet1!A1".
  *
  * @access private
  * @see writeUrl()
  * @param integer $row1   Start row
  * @param integer $col1   Start column
  * @param integer $row2   End row
  * @param integer $col2   End column
  * @param string  $url    URL string
  * @return integer
  */
 public function writeUrlInternal($row1, $col1, $row2, $col2, $url)
 {
     $record = 0x1b8;
     // Record identifier
     $length = 0x0;
     // Bytes to follow
     // Strip URL type
     $url = preg_replace('/^internal:/', '', $url);
     // Pack the undocumented parts of the hyperlink stream
     $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
     // Pack the option flags
     $options = pack("V", 0x8);
     // Convert the URL type and to a null terminated wchar string
     $url .= "";
     // character count
     $url_len = \PHPExcel\Shared\StringHelper::countCharacters($url);
     $url_len = pack('V', $url_len);
     $url = \PHPExcel\Shared\StringHelper::convertEncoding($url, 'UTF-16LE', 'UTF-8');
     // Calculate the data length
     $length = 0x24 + strlen($url);
     // Pack the header data
     $header = pack("vv", $record, $length);
     $data = pack("vvvv", $row1, $row2, $col1, $col2);
     // Write the packed data
     $this->append($header . $data . $unknown1 . $options . $url_len . $url);
     return 0;
 }