Sets the sheet visibility
This commit is contained in:
parent
d68a829e1f
commit
d32dd188d5
@ -33,6 +33,9 @@ class Sheet
|
|||||||
/** @var string Name of the sheet */
|
/** @var string Name of the sheet */
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
|
/** @var bool isVisible visibility of the sheet */
|
||||||
|
protected $isVisible;
|
||||||
|
|
||||||
/** @var \Box\Spout\Common\Helper\StringHelper */
|
/** @var \Box\Spout\Common\Helper\StringHelper */
|
||||||
protected $stringHelper;
|
protected $stringHelper;
|
||||||
|
|
||||||
@ -50,6 +53,7 @@ class Sheet
|
|||||||
|
|
||||||
$this->stringHelper = new StringHelper();
|
$this->stringHelper = new StringHelper();
|
||||||
$this->setName(self::DEFAULT_SHEET_NAME_PREFIX . ($sheetIndex + 1));
|
$this->setName(self::DEFAULT_SHEET_NAME_PREFIX . ($sheetIndex + 1));
|
||||||
|
$this->setVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,6 +74,23 @@ class Sheet
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api
|
||||||
|
* @return bool isVisible visibility of the sheet
|
||||||
|
*/
|
||||||
|
public function isVisible()
|
||||||
|
{
|
||||||
|
return $this->isVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVisibility($visibility = true)
|
||||||
|
{
|
||||||
|
$this->isVisible = $visibility;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the sheet. Note that Excel has some restrictions on the name:
|
* Sets the name of the sheet. Note that Excel has some restrictions on the name:
|
||||||
* - it should not be blank
|
* - it should not be blank
|
||||||
|
@ -289,8 +289,10 @@ EOD;
|
|||||||
/** @var Worksheet $worksheet */
|
/** @var Worksheet $worksheet */
|
||||||
foreach ($worksheets as $worksheet) {
|
foreach ($worksheets as $worksheet) {
|
||||||
$worksheetName = $worksheet->getExternalSheet()->getName();
|
$worksheetName = $worksheet->getExternalSheet()->getName();
|
||||||
|
$worksheetState = ( $worksheet->getExternalSheet()->isVisible() ) ? 'visible' : 'hidden';
|
||||||
|
|
||||||
$worksheetId = $worksheet->getId();
|
$worksheetId = $worksheet->getId();
|
||||||
$workbookXmlFileContents .= '<sheet name="' . $escaper->escape($worksheetName) . '" sheetId="' . $worksheetId . '" r:id="rIdSheet' . $worksheetId . '"/>';
|
$workbookXmlFileContents .= '<sheet name="' . $escaper->escape($worksheetName) . '" sheetId="' . $worksheetId . '" state="' . $worksheetState. '" r:id="rIdSheet' . $worksheetId . '"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$workbookXmlFileContents .= <<<EOD
|
$workbookXmlFileContents .= <<<EOD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user