/**
  * Returns content of "/xl/workbook.xml"
  *
  * @return string
  */
 protected function buildWorkbookXML()
 {
     /** @var string $xml */
     $xml = "";
     $xml .= "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
     $xml .= "<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" ";
     $xml .= "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ";
     $xml .= "xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x15\" ";
     $xml .= "xmlns:x15=\"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main\">";
     $xml .= "<fileVersion appName=\"xl\" lastEdited=\"6\" lowestEdited=\"6\" rupBuild=\"14420\"/>";
     $xml .= "<workbookPr defaultThemeVersion=\"153222\"/>";
     $xml .= "<bookViews>";
     $xml .= "<workbookView xWindow=\"0\" yWindow=\"0\" windowWidth=\"24270\" windowHeight=\"12570\"/>";
     $xml .= "</bookViews>";
     $xml .= "<sheets>";
     /** @var int $i */
     $i = 0;
     /** @var  $sheet \BW\XlsxWriter\ExcelSheet */
     foreach ($this->sheets as $sheet) {
         $xml .= "<sheet name=\"" . ExcelUtility::xmlspecialchars($sheet->getSheetName()) . "\" sheetId=\"" . ($i + 1) . "\" r:id=\"rId" . ($i + 2) . "\"/>";
         $i++;
     }
     $xml .= "</sheets>";
     $xml .= "<calcPr calcId=\"152511\"/>";
     $xml .= "</workbook>";
     return $xml;
 }
 /**
  * Returns content of sheet xml file
  *
  * @return string
  */
 public function buildXML()
 {
     $xml = "";
     $xml .= "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
     $xml .= "<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" ";
     $xml .= "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ";
     $xml .= "xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac\" ";
     $xml .= "xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\">";
     /** @var string $maxCell */
     $maxCell = ExcelUtility::getXlSCell($this->rowCount - 1, count($this->columns) - 1);
     $xml .= "<dimension ref=\"" . $maxCell . "\" />";
     $xml .= "<sheetViews>";
     $xml .= "<sheetView tabSelected=\"1\" workbookViewId=\"0\">";
     $xml .= "<selection activeCell=\"A1\" sqref=\"A1\"/>";
     $xml .= "</sheetView>";
     $xml .= "</sheetViews>";
     $xml .= "<sheetFormatPr baseColWidth=\"10\" defaultRowHeight=\"15\" x14ac:dyDescent=\"0.25\"/>";
     if (!empty($this->columnWidths)) {
         $xml .= "<cols>";
         /**
          * @var int   $i
          * @var float $width
          */
         foreach ($this->columnWidths as $i => $width) {
             $xml .= "<col min=\"" . ($i + 1) . "\" max=\"" . ($i + 1) . "\" width=\"" . $width . "\" bestFit=\"1\" customWidth=\"1\"/>";
         }
         $xml .= "</cols>";
     }
     $xml .= "<sheetData>";
     $xml .= $this->sheetData;
     $xml .= "</sheetData>";
     $xml .= "<pageMargins left=\"0.7\" right=\"0.7\" top=\"0.78740157499999996\" bottom=\"0.78740157499999996\" header=\"0.3\" footer=\"0.3\"/>";
     $xml .= "</worksheet>";
     return $xml;
 }
 /**
  * Purges the buffer
  */
 protected function purge()
 {
     if ($this->stream) {
         if ($this->checkUTF8 && !ExcelUtility::isValidUTF8($this->buffer)) {
             $this->checkUTF8 = FALSE;
         }
         fwrite($this->stream, $this->buffer);
         $this->buffer = "";
     }
 }