Example #1
0
 /**
  * @param $text
  *
  * @return string
  */
 public function getData($text)
 {
     $charCount = StringUtils::countCharacters($text);
     $text = StringUtils::toBiff8UnicodeLongWoLenInfo($text);
     $grbit = 0x212;
     $rotation = 0;
     $data = pack('vv', $grbit, $rotation);
     $data .= pack('vvv', 0, 0, 0);
     //reserved
     $txoRunsLength = 0x10;
     $data .= pack('vv', $charCount, $txoRunsLength);
     $data .= pack('V', 0);
     //reserved
     $result = $this->getFullRecord($data);
     $continue = new ContinueRecord();
     $result .= $continue->getDataRaw($text);
     $txoRunsData = pack('H*', '00000500');
     $txoRunsData .= pack('H*', '2F00');
     $txoRunsData .= pack('H*', '0C00');
     $lastRun = pack('v', $charCount);
     $lastRun .= pack('H*', '000000000200');
     $txoRunsData .= $lastRun;
     $result .= $continue->getDataRaw($txoRunsData);
     return $result;
 }
Example #2
0
 /**
  * Generate BOUNDSHEET record.
  *
  * @param string $sheetName Worksheet name
  * @param integer $offset Location of worksheet BOF
  * @return string
  */
 public function getData($sheetName, $offset = 0)
 {
     $sheetState = Worksheet::STATE_VISIBLE;
     $sheetType = Worksheet::TYPE_SHEET;
     $data = pack("VCC", $offset, $sheetState, $sheetType);
     $data .= StringUtils::toBiff8UnicodeShort($sheetName);
     return $this->getFullRecord($data);
 }
 /**
  * @param Range $range
  * @param $url
  *
  * @return string
  */
 public function getData(Range $range, $url)
 {
     $url = StringUtils::toNullTerminatedWchar($url);
     $options = $this->getOptions($url);
     $data = $this->getCommonData($range, $options);
     $data .= $this->getTextMarkData($url);
     return $this->getFullRecord($data);
 }
Example #4
0
 /**
  * Generate a note associated with the cell given by the row and column.
  * NOTE records don't have a length limit
  * @param integer $row
  * @param integer $col
  * @param integer $objId
  *
  * @return string
  */
 public function getData($row, $col, $objId)
 {
     $grbit = 0x0;
     $data = pack("vvvv", $row, $col, $grbit, $objId);
     $author = 'xls-writer';
     $data .= StringUtils::toBiff8UnicodeLong($author);
     return $this->getFullRecord($data);
 }
Example #5
0
 /**
  * @param Range $range
  * @param $url
  *
  * @return string
  */
 public function getData(Range $range, $url)
 {
     $url = StringUtils::toNullTerminatedWchar($url);
     $options = $this->getOptions($url);
     $data = $this->getCommonData($range, $options);
     $data .= pack("H*", static::MONIKER_GUID);
     $data .= pack("V", strlen($url));
     $data .= $url;
     return $this->getFullRecord($data);
 }
Example #6
0
 /**
  * @param $type
  * @param $sheetIndex
  * @param $formulaData
  *
  * @return string
  */
 public function getData($type, $sheetIndex, $formulaData)
 {
     $options = 0x20;
     // Option flags
     $name = pack("C", $type);
     $nameLen = StringUtils::countCharacters($name);
     $name = StringUtils::toBiff8UnicodeLongWoLenInfo($name);
     $formulaLen = strlen($formulaData);
     $data = pack("vC", $options, 0);
     $data .= pack("Cv", $nameLen, $formulaLen);
     $data .= pack("vv", 0, $sheetIndex);
     $data .= pack("CCCC", 0, 0, 0, 0);
     $data .= $name . $formulaData;
     return $this->getFullRecord($data);
 }
 /**
  * @param Range $range
  * @param $url
  *
  * @return string
  */
 public function getData(Range $range, $url)
 {
     $cellRef = null;
     if (preg_match("/\\#/", $url)) {
         $parts = explode('#', $url);
         $url = $parts[0];
         $cellRef = $parts[1];
     }
     // Calculate the up-level dir count e.g.. (..\..\..\ == 3)
     $upCount = preg_match_all("/\\.\\.\\\\/", $url, $useless);
     // Store the short dos dir name (null terminated)
     $urlWithoutDots = preg_replace("/\\.\\.\\\\/", '', $url) . "";
     // Unknown 24 bytes
     $unknown = pack("H*", 'FFFFADDE' . str_repeat('00', 20));
     $streamLen = pack("V", 0);
     $options = $this->getOptions($url);
     $data = $this->getCommonData($range, $options);
     $data .= pack("H*", static::MONIKER_GUID) . pack("v", $upCount) . pack("V", strlen($urlWithoutDots)) . $urlWithoutDots . $unknown . $streamLen;
     if ($cellRef) {
         $cellRef = StringUtils::toNullTerminatedWchar($cellRef);
         $data .= $this->getTextMarkData($cellRef);
     }
     return $this->getFullRecord($data);
 }
Example #8
0
 /**
  * Generate FORMAT record for non "built-in" numerical formats.
  *
  * @param string $format Custom format string
  * @param integer $formatIndex   Format index code
  * @return string
  */
 public function getData($format, $formatIndex)
 {
     $data = pack("v", $formatIndex);
     $data .= StringUtils::toBiff8UnicodeLong($format);
     return $this->getFullRecord($data);
 }