Write Excel BIFF WINDOW1 record.

@access private
19865
function _storeWindow1()
    {
        $record    = 0x003D;                 // Record identifier
        $length    = 0x0012;                 // Number of bytes to follow

        $xWn       = 0x0000;                 // Horizontal position of window
        $yWn       = 0x0000;                 // Vertical position of window
        $dxWn      = 0x25BC;                 // Width of window
        $dyWn      = 0x1572;                 // Height of window

        $grbit     = 0x0038;                 // Option flags
        $ctabsel   = $this->_selected;       // Number of workbook tabs selected
        $wTabRatio = 0x0258;                 // Tab to scrollbar ratio

        $itabFirst = $this->_firstsheet;     // 1st displayed worksheet
        $itabCur   = $this->_activesheet;    // Active worksheet

        $header    = pack("vv",        $record, $length);
        $data      = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
                                       $grbit,
                                       $itabCur, $itabFirst,
                                       $ctabsel, $wTabRatio);
        $this->_append($header . $data);
    }
1103769
private function _writeDatemode()
	{
		$record    = 0x0022;         // Record identifier
		$length    = 0x0002;         // Bytes to follow

		$f1904     = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) ?
			1 : 0;   // Flag for 1904 date system

		$header    = pack("vv", $record, $length);
		$data      = pack("v", $f1904);
		$this->_append($header . $data);
	}
247254
private function _writeMarginTop()
	{
		$record  = 0x0028;				   // Record identifier
		$length  = 0x0008;				   // Bytes to follow

		$margin  = $this->_phpSheet->getPageMargins()->getTop();	 // Margin in inches

		$header	= pack("vv",  $record, $length);
		$data	  = pack("d",   $margin);
		if (self::getByteOrder()) { // if it's Big Endian
			$data = strrev($data);
		}

		$this->_append($header . $data);
	}
678208
function _storeOLEFile()
    {
        if($this->_BIFF_version == 0x0600) {
            $OLE = new OLE_PPS_File(OLE::Asc2Ucs('Workbook'));
        } else {
            $OLE = new OLE_PPS_File(OLE::Asc2Ucs('Book'));
        }
        if ($this->_tmp_dir != '') {
            $OLE->setTempDir($this->_tmp_dir);
        }
        $res = $OLE->init();
        if ($this->isError($res)) {
            return $this->raiseError("OLE Error: ".$res->getMessage());
        }
        $OLE->append($this->_data);

        $total_worksheets = count($this->_worksheets);
        for ($i = 0; $i < $total_worksheets; $i++) {
            while ($tmp = $this->_worksheets[$i]->getData()) {
                $OLE->append($tmp);
            }
        }

        $root = new OLE_PPS_Root(time(), time(), array($OLE));
        if ($this->_tmp_dir != '') {
            $root->setTempDir($this->_tmp_dir);
        }

        $res = $root->save($this->_filename);
        if ($this->isError($res)) {
            return $this->raiseError("OLE Error: ".$res->getMessage());
        }
        return true;
    }
316476
def write_row_default(row, colMic, colMac)       #:nodoc:

    record      = 0x0208               # Record identifier
    length      = 0x0010               # Number of bytes to follow

    miyRw       = 0xFF                 # Row height
    irwMac      = 0x0000               # Used by Excel to optimise loading
    reserved    = 0x0000               # Reserved
    grbit       = 0x0100               # Option flags
    ixfe        = 0x0F                 # XF index

    store_simple(record, length,
                 row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe)
  end
509118
private function _writeBreaks()
	{
		// initialize
		$vbreaks = array();
		$hbreaks = array();

		foreach ($this->_phpSheet->getBreaks() as $cell => $breakType) {
			// Fetch coordinates
			$coordinates = PHPExcel_Cell::coordinateFromString($cell);

			// Decide what to do by the type of break
			switch ($breakType) {
				case PHPExcel_Worksheet::BREAK_COLUMN:
					// Add to list of vertical breaks
					$vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
					break;

				case PHPExcel_Worksheet::BREAK_ROW:
					// Add to list of horizontal breaks
					$hbreaks[] = $coordinates[1];
					break;

				case PHPExcel_Worksheet::BREAK_NONE:
				default:
					// Nothing to do
					break;
			}
		}

		//horizontal page breaks
		if (!empty($hbreaks)) {

			// Sort and filter array of page breaks
			sort($hbreaks, SORT_NUMERIC);
			if ($hbreaks[0] == 0) { // don't use first break if it's 0
				array_shift($hbreaks);
			}

			$record  = 0x001b;			   // Record identifier
			$cbrk	= count($hbreaks);	   // Number of page breaks
			$length  = 2 + 6 * $cbrk;	  // Bytes to follow

			$header  = pack("vv", $record, $length);
			$data	= pack("v",  $cbrk);

			// Append each page break
			foreach ($hbreaks as $hbreak) {
				$data .= pack("vvv", $hbreak, 0x0000, 0x00ff);
			}

			$this->_append($header . $data);
		}

		// vertical page breaks
		if (!empty($vbreaks)) {

			// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
			// It is slightly higher in Excel 97/200, approx. 1026
			$vbreaks = array_slice($vbreaks, 0, 1000);

			// Sort and filter array of page breaks
			sort($vbreaks, SORT_NUMERIC);
			if ($vbreaks[0] == 0) { // don't use first break if it's 0
				array_shift($vbreaks);
			}

			$record  = 0x001a;			   // Record identifier
			$cbrk	= count($vbreaks);	   // Number of page breaks
			$length  = 2 + 6 * $cbrk;	  // Bytes to follow

			$header  = pack("vv",  $record, $length);
			$data	= pack("v",   $cbrk);

			// Append each page break
			foreach ($vbreaks as $vbreak) {
				$data .= pack("vvv", $vbreak, 0x0000, 0xffff);
			}

			$this->_append($header . $data);
		}
	}
112397
private function _writeHcenter()
	{
		$record   = 0x0083;			  // Record identifier
		$length   = 0x0002;			  // Bytes to follow

		$fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0;	 // Horizontal centering

		$header	= pack("vv", $record, $length);
		$data	  = pack("v",  $fHCenter);

		$this->_append($header.$data);
	}
265626
private void writeEOFRecord() throws IOException {
        for (int i = 0; i < this.recordBuf.length; ++i) {
            this.recordBuf[i] = 0;
        }

        this.buffer.writeRecord(this.recordBuf);
    }
1141154
private function _writeZoom()
	{
		// If scale is 100 we don't need to write a record
		if ($this->_phpSheet->getSheetView()->getZoomScale() == 100) {
			return;
		}

		$record	  = 0x00A0;			   // Record identifier
		$length	  = 0x0004;			   // Bytes to follow

		$header	  = pack("vv", $record, $length);
		$data		= pack("vv", $this->_phpSheet->getSheetView()->getZoomScale(), 100);
		$this->_append($header . $data);
	}
991049
private function readDefault()
    {
        // offset 0; size: 2; recVer and recInstance
        $verInstance = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos);

        // offset: 2; size: 2: Record Type
        $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);

        // bit: 0-3; mask: 0x000F; recVer
        $recVer = (0x000F & $verInstance) >> 0;

        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
        $recordData = substr($this->data, $this->pos + 8, $length);

        // move stream pointer to next record
        $this->pos += 8 + $length;
    }
191173
private function _readSheetProtection()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if ($this->_readDataOnly) {
			return;
		}

		// offset: 0; size: 2; repeated record header

		// offset: 2; size: 2; FRT cell reference flag (=0 currently)

		// offset: 4; size: 8; Currently not used and set to 0

		// offset: 12; size: 2; Shared feature type index (2=Enhanced Protetion, 4=SmartTag)
		$isf = self::_GetInt2d($recordData, 12);
		if ($isf != 2) {
			return;
		}

		// offset: 14; size: 1; =1 since this is a feat header

		// offset: 15; size: 4; size of rgbHdrSData

		// rgbHdrSData, assume "Enhanced Protection"
		// offset: 19; size: 2; option flags
		$options = self::_GetInt2d($recordData, 19);

		// bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects
		$bool = (0x0001 & $options) >> 0;
		$this->_phpSheet->getProtection()->setObjects(!$bool);

		// bit: 1; mask 0x0002; edit scenarios
		$bool = (0x0002 & $options) >> 1;
		$this->_phpSheet->getProtection()->setScenarios(!$bool);

		// bit: 2; mask 0x0004; format cells
		$bool = (0x0004 & $options) >> 2;
		$this->_phpSheet->getProtection()->setFormatCells(!$bool);

		// bit: 3; mask 0x0008; format columns
		$bool = (0x0008 & $options) >> 3;
		$this->_phpSheet->getProtection()->setFormatColumns(!$bool);

		// bit: 4; mask 0x0010; format rows
		$bool = (0x0010 & $options) >> 4;
		$this->_phpSheet->getProtection()->setFormatRows(!$bool);

		// bit: 5; mask 0x0020; insert columns
		$bool = (0x0020 & $options) >> 5;
		$this->_phpSheet->getProtection()->setInsertColumns(!$bool);

		// bit: 6; mask 0x0040; insert rows
		$bool = (0x0040 & $options) >> 6;
		$this->_phpSheet->getProtection()->setInsertRows(!$bool);

		// bit: 7; mask 0x0080; insert hyperlinks
		$bool = (0x0080 & $options) >> 7;
		$this->_phpSheet->getProtection()->setInsertHyperlinks(!$bool);

		// bit: 8; mask 0x0100; delete columns
		$bool = (0x0100 & $options) >> 8;
		$this->_phpSheet->getProtection()->setDeleteColumns(!$bool);

		// bit: 9; mask 0x0200; delete rows
		$bool = (0x0200 & $options) >> 9;
		$this->_phpSheet->getProtection()->setDeleteRows(!$bool);

		// bit: 10; mask 0x0400; select locked cells
		$bool = (0x0400 & $options) >> 10;
		$this->_phpSheet->getProtection()->setSelectLockedCells(!$bool);

		// bit: 11; mask 0x0800; sort cell range
		$bool = (0x0800 & $options) >> 11;
		$this->_phpSheet->getProtection()->setSort(!$bool);

		// bit: 12; mask 0x1000; auto filter
		$bool = (0x1000 & $options) >> 12;
		$this->_phpSheet->getProtection()->setAutoFilter(!$bool);

		// bit: 13; mask 0x2000; pivot tables
		$bool = (0x2000 & $options) >> 13;
		$this->_phpSheet->getProtection()->setPivotTables(!$bool);

		// bit: 14; mask 0x4000; select unlocked cells
		$bool = (0x4000 & $options) >> 14;
		$this->_phpSheet->getProtection()->setSelectUnlockedCells(!$bool);

		// offset: 21; size: 2; not used
	}
777866
private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null)
	{
		$objWriter->startElement('fileVersion');
		$objWriter->writeAttribute('appName', 'xl');
		$objWriter->writeAttribute('lastEdited', '4');
		$objWriter->writeAttribute('lowestEdited', '4');
		$objWriter->writeAttribute('rupBuild', '4505');
		$objWriter->endElement();
	}
647603
function _storeExternsheetBiff8()
    {
        $total_references = count($this->_parser->_references);
        $record   = 0x0017;                     // Record identifier
        $length   = 2 + 6 * $total_references;  // Number of bytes to follow

        $supbook_index = 0;           // FIXME: only using internal SUPBOOK record
        $header           = pack("vv",  $record, $length);
        $data             = pack('v', $total_references);
        for ($i = 0; $i < $total_references; $i++) {
            $data .= $this->_parser->_references[$i];
        }
        $this->_append($header . $data);
    }
545831
def _write(self, f):
        """"""
        log.debug("writing ndef record at offset {0}".format(f.tell()))

        record_type = self.type
        record_name = self.name
        record_data = self.data
        
        if record_type == '':
            header_flags = 0; record_name = ''; record_data = ''
        elif record_type.startswith("urn:nfc:wkt:"):
            header_flags = 1; record_type = record_type[12:]
        elif re.match(r'[a-zA-Z0-9-]+/[a-zA-Z0-9-+.]+', record_type):
            header_flags = 2; record_type = record_type
        elif re.match(r'[a-zA-Z][a-zA-Z0-9+-.]*://', record_type):
            header_flags = 3; record_type = record_type
        elif record_type.startswith("urn:nfc:ext:"):
            header_flags = 4; record_type = record_type[12:]
        elif record_type == 'unknown':
            header_flags = 5; record_type = ''
        elif record_type == 'unchanged':
            header_flags = 6; record_type = ''

        type_length = len(record_type)
        data_length = len(record_data)
        name_length = len(record_name)

        if self._message_begin:
            header_flags |= 0x80
        if self._message_end:
            header_flags |= 0x40
        if data_length < 256:
            header_flags |= 0x10
        if name_length > 0:
            header_flags |= 0x08

        if data_length < 256:
            f.write(struct.pack(">BBB", header_flags, type_length, data_length))
        else:
            f.write(struct.pack(">BBL", header_flags, type_length, data_length))
        if name_length > 0:
            f.write(struct.pack(">B", name_length))

        f.write(record_type)
        f.write(record_name)
        f.write(record_data)
793828
function write_ws_biff8(idx, opts, wb) {
	var ba = buf_array();
	var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {};
	var _WB = ((wb||{}).Workbook||{});
	var _sheet = ((_WB.Sheets||[])[idx]||{});
	var dense = Array.isArray(ws);
	var b8 = opts.biff == 8;
	var ref, rr = "", cols = [];
	var range = safe_decode_range(ws['!ref'] || "A1");
	var MAX_ROWS = b8 ? 65536 : 16384;
	if(range.e.c > 0xFF || range.e.r >= MAX_ROWS) {
		if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384");
		range.e.c = Math.min(range.e.c, 0xFF);
		range.e.r = Math.min(range.e.c, MAX_ROWS-1);
	}

	write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts));
	/* ... */
	write_biff_rec(ba, "CalcMode", writeuint16(1));
	write_biff_rec(ba, "CalcCount", writeuint16(100));
	write_biff_rec(ba, "CalcRefMode", writebool(true));
	write_biff_rec(ba, "CalcIter", writebool(false));
	write_biff_rec(ba, "CalcDelta", write_Xnum(0.001));
	write_biff_rec(ba, "CalcSaveRecalc", writebool(true));
	write_biff_rec(ba, "PrintRowCol", writebool(false));
	write_biff_rec(ba, "PrintGrid", writebool(false));
	write_biff_rec(ba, "GridSet", writeuint16(1));
	write_biff_rec(ba, "Guts", write_Guts([0,0]));
	/* ... */
	write_biff_rec(ba, "HCenter", writebool(false));
	write_biff_rec(ba, "VCenter", writebool(false));
	/* ... */
	write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
	/* ... */

	if(b8) ws['!links'] = [];
	for(var R = range.s.r; R <= range.e.r; ++R) {
		rr = encode_row(R);
		for(var C = range.s.c; C <= range.e.c; ++C) {
			if(R === range.s.r) cols[C] = encode_col(C);
			ref = cols[C] + rr;
			var cell = dense ? (ws[R]||[])[C] : ws[ref];
			if(!cell) continue;
			/* write cell */
			write_ws_biff8_cell(ba, cell, R, C, opts);
			if(b8 && cell.l) ws['!links'].push([ref, cell.l]);
		}
	}
	var cname = _sheet.CodeName || _sheet.name || s;
	/* ... */
	if(b8 && _WB.Views) write_biff_rec(ba, "Window2", write_Window2(_WB.Views[0]));
	/* ... */
	if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, "MergeCells", write_MergeCells(ws['!merges']));
	/* ... */
	if(b8) write_ws_biff8_hlinks(ba, ws);
	/* ... */
	write_biff_rec(ba, "CodeName", write_XLUnicodeString(cname, opts));
	/* ... */
	if(b8) write_FEAT(ba, ws);
	/* ... */
	write_biff_rec(ba, "EOF");
	return ba.end();
}
1220766
function close()
	{
		$_phpSheet = $this->_phpSheet;

		$num_sheets = $_phpSheet->getParent()->getSheetCount();

		// Write BOF record
		$this->_storeBof(0x0010);

		// Write PRINTHEADERS
		$this->_writePrintHeaders();

		// Write PRINTGRIDLINES
		$this->_writePrintGridlines();

		// Write GRIDSET
		$this->_writeGridset();

		// Calculate column widths
		$_phpSheet->calculateColumnWidths();

		// Column dimensions
		if (($defaultWidth = $_phpSheet->getDefaultColumnDimension()->getWidth()) < 0) {
			$defaultWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($_phpSheet->getParent()->getDefaultStyle()->getFont());
		}

		$columnDimensions = $_phpSheet->getColumnDimensions();
		$maxCol = $this->_lastColumnIndex -1;
		for ($i = 0; $i <= $maxCol; ++$i) {
			$hidden = 0;
			$level = 0;
			$xfIndex = 15; // there are 15 cell style Xfs

			$width = $defaultWidth;

			$columnLetter = PHPExcel_Cell::stringFromColumnIndex($i);
			if (isset($columnDimensions[$columnLetter])) {
				$columnDimension = $columnDimensions[$columnLetter];
				if ($columnDimension->getWidth() >= 0) {
					$width = $columnDimension->getWidth();
				}
				$hidden = $columnDimension->getVisible() ? 0 : 1;
				$level = $columnDimension->getOutlineLevel();
				$xfIndex = $columnDimension->getXfIndex() + 15; // there are 15 cell style Xfs
			}

			// Components of _colinfo:
			// $firstcol first column on the range
			// $lastcol  last column on the range
			// $width	width to set
			// $xfIndex  The optional cell style Xf index to apply to the columns
			// $hidden   The optional hidden atribute
			// $level	The optional outline level
			$this->_colinfo[] = array($i, $i, $width, $xfIndex, $hidden, $level);
		}

		// Write GUTS
		$this->_writeGuts();

		// Write DEFAULTROWHEIGHT
		$this->_writeDefaultRowHeight();

		// Write WSBOOL
		$this->_writeWsbool();

		// Write horizontal and vertical page breaks
		$this->_writeBreaks();

		// Write page header
		$this->_writeHeader();

		// Write page footer
		$this->_writeFooter();

		// Write page horizontal centering
		$this->_writeHcenter();

		// Write page vertical centering
		$this->_writeVcenter();

		// Write left margin
		$this->_writeMarginLeft();

		// Write right margin
		$this->_writeMarginRight();

		// Write top margin
		$this->_writeMarginTop();

		// Write bottom margin
		$this->_writeMarginBottom();

		// Write page setup
		$this->_writeSetup();

		// Write sheet protection
		$this->_writeProtect();

		// Write SCENPROTECT
		$this->_writeScenProtect();

		// Write OBJECTPROTECT
		$this->_writeObjectProtect();

		// Write sheet password
		$this->_writePassword();

		// Write DEFCOLWIDTH record
		$this->_writeDefcol();

		// Write the COLINFO records if they exist
		if (!empty($this->_colinfo)) {
			$colcount = count($this->_colinfo);
			for ($i = 0; $i < $colcount; ++$i) {
				$this->_writeColinfo($this->_colinfo[$i]);
			}
		}
		$autoFilterRange = $_phpSheet->getAutoFilter()->getRange();
		if (!empty($autoFilterRange)) {
			// Write AUTOFILTERINFO
			$this->_writeAutoFilterInfo();
		}

		// Write sheet dimensions
		$this->_writeDimensions();

		// Row dimensions
		foreach ($_phpSheet->getRowDimensions() as $rowDimension) {
			$xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs
			$this->_writeRow( $rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel() );
		}

		// Write Cells
		foreach ($_phpSheet->getCellCollection() as $cellID) {
			$cell = $_phpSheet->getCell($cellID);
			$row = $cell->getRow() - 1;
			$column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;

			// Don't break Excel!
//			if ($row + 1 > 65536 or $column + 1 > 256) {
			if ($row > 65535 || $column > 255) {
				break;
			}

			// Write cell value
			$xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs

			$cVal = $cell->getValue();
			if ($cVal instanceof PHPExcel_RichText) {
				// $this->_writeString($row, $column, $cVal->getPlainText(), $xfIndex);
				$arrcRun = array();
				$str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8');
				$str_pos = 0;
				$elements = $cVal->getRichTextElements();
				foreach ($elements as $element) {
					// FONT Index
					if ($element instanceof PHPExcel_RichText_Run) {
						$str_fontidx = $this->_fntHashIndex[$element->getFont()->getHashCode()];
					}
					else {
						$str_fontidx = 0;
					}
					$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
					// Position FROM
					$str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8');
				}
				$this->_writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
			} else {
				switch ($cell->getDatatype()) {
					case PHPExcel_Cell_DataType::TYPE_STRING:
					case PHPExcel_Cell_DataType::TYPE_NULL:
						if ($cVal === '' || $cVal === null) {
							$this->_writeBlank($row, $column, $xfIndex);
						} else {
							$this->_writeString($row, $column, $cVal, $xfIndex);
						}
						break;

					case PHPExcel_Cell_DataType::TYPE_NUMERIC:
						$this->_writeNumber($row, $column, $cVal, $xfIndex);
						break;

					case PHPExcel_Cell_DataType::TYPE_FORMULA:
						$calculatedValue = $this->_preCalculateFormulas ?
							$cell->getCalculatedValue() : null;
						$this->_writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue);
						break;

					case PHPExcel_Cell_DataType::TYPE_BOOL:
						$this->_writeBoolErr($row, $column, $cVal, 0, $xfIndex);
						break;

					case PHPExcel_Cell_DataType::TYPE_ERROR:
						$this->_writeBoolErr($row, $column, self::_mapErrorCode($cVal), 1, $xfIndex);
						break;

				}
			}
		}

		// Append
		$this->_writeMsoDrawing();

		// Write WINDOW2 record
		$this->_writeWindow2();

		// Write PLV record
		$this->_writePageLayoutView();

		// Write ZOOM record
		$this->_writeZoom();
		if ($_phpSheet->getFreezePane()) {
			$this->_writePanes();
		}

		// Write SELECTION record
		$this->_writeSelection();

		// Write MergedCellsTable Record
		$this->_writeMergedCells();

		// Hyperlinks
		foreach ($_phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) {
			list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinate);

			$url = $hyperlink->getUrl();

			if ( strpos($url, 'sheet://') !== false ) {
				// internal to current workbook
				$url = str_replace('sheet://', 'internal:', $url);

			} else if ( preg_match('/^(http:|https:|ftp:|mailto:)/', $url) ) {
				// URL
				// $url = $url;

			} else {
				// external (local file)
				$url = 'external:' . $url;
			}

			$this->_writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url);
		}

		$this->_writeDataValidity();
		$this->_writeSheetLayout();

		// Write SHEETPROTECTION record
		$this->_writeSheetProtection();
		$this->_writeRangeProtection();

		$arrConditionalStyles = $_phpSheet->getConditionalStylesCollection();
		if(!empty($arrConditionalStyles)){
			$arrConditional = array();
			// @todo CFRule & CFHeader
			// Write CFHEADER record
			$this->_writeCFHeader();
			// Write ConditionalFormattingTable records
			foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) {
				foreach ($conditionalStyles as $conditional) {
					if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
						|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
						if(!in_array($conditional->getHashCode(), $arrConditional)){
							$arrConditional[] = $conditional->getHashCode();
							// Write CFRULE record
							$this->_writeCFRule($conditional);
						}
					}
				}
			}
		}

		$this->_storeEof();
	}
458414
def __write_record(self, record_type, data):
    """"""
    length = len(data)

    crc = crc32c.crc_update(crc32c.CRC_INIT, [record_type])
    crc = crc32c.crc_update(crc, data)
    crc = crc32c.crc_finalize(crc)

    self.__writer.write(
        struct.pack(_HEADER_FORMAT, _mask_crc(crc), length, record_type))
    self.__writer.write(data)
    self.__position += _HEADER_LENGTH + length